vim/telescope: rename variables

This commit is contained in:
Fernando Schauenburg 2023-08-06 18:29:27 +02:00
parent e6e7492373
commit 9eb98416a7

View file

@ -66,38 +66,38 @@ local config = function()
} }
local themes = require 'telescope.themes' local themes = require 'telescope.themes'
local builtin = require 'telescope.builtin' local ts = require 'telescope.builtin'
local custom = { local my = {
all_files = function(opts) all_files = function(opts)
builtin.find_files(vim.tbl_extend('keep', opts or {}, { ts.find_files(vim.tbl_extend('keep', opts or {}, {
hidden = true, hidden = true,
no_ignore = true, no_ignore = true,
no_ignore_parent = true, no_ignore_parent = true,
})) }))
end, end,
colorschemes = function(opts) colorschemes = function(opts)
builtin.colorscheme(themes.get_dropdown(vim.tbl_extend('keep', opts or {}, { ts.colorscheme(themes.get_dropdown(vim.tbl_extend('keep', opts or {}, {
enable_preview = true, enable_preview = true,
}))) })))
end, end,
dotfiles = function(opts) dotfiles = function(opts)
builtin.find_files(vim.tbl_extend('keep', opts or {}, { ts.find_files(vim.tbl_extend('keep', opts or {}, {
cwd = '~/.dotfiles', cwd = '~/.dotfiles',
hidden = true, hidden = true,
})) }))
end, end,
selection = function(_) selection = function(_)
local selected = require('user.util').get_selected_text() local selected = require('user.util').get_selected_text()
builtin.grep_string { ts.grep_string {
prompt_title = string.format('  Grep: %s ', selected), prompt_title = string.format('  Grep: %s ', selected),
search = selected, search = selected,
} }
end, end,
spell_suggest = function(opts) spell_suggest = function(opts)
builtin.spell_suggest(themes.get_cursor(opts)) ts.spell_suggest(themes.get_cursor(opts))
end, end,
here = function(opts) here = function(opts)
builtin.current_buffer_fuzzy_find(opts) ts.current_buffer_fuzzy_find(opts)
end, end,
} }
@ -112,50 +112,50 @@ local config = function()
end end
map('<c-p>', { map('<c-p>', {
-- ╭────╮ ╭──────╮ ╭────────────╮ ╭───────────────────╮ -- ╭────╮ ╭──────╮ ╭────────────╮ ╭───────────────────╮
-- │keys│ │picker│ │prompt title│ │mapping description│ -- │keys│ │picker│ │prompt title│ │mapping description│
-- ╰────╯ ╰──────╯ ╰────────────╯ ╰───────────────────╯ -- ╰────╯ ╰──────╯ ╰────────────╯ ╰───────────────────╯
n = { n = {
{ 'a', builtin.autocommands , ' Autocommands' , '[a]utocommands' }, { 'a', ts.autocommands , ' Autocommands' , '[a]utocommands' },
{ 'b', builtin.buffers , ' Buffers' , '[b]uffers' }, { 'b', ts.buffers , ' Buffers' , '[b]uffers' },
{ 'c', custom.colorschemes , ' Colorschemes' , '[c]olorschemes' }, { 'c', my.colorschemes , ' Colorschemes' , '[c]olorschemes' },
{ 'd', builtin.diagnostics , '󰀪 Diagnostics' , '[d]iagnostics' }, { 'd', ts.diagnostics , '󰀪 Diagnostics' , '[d]iagnostics' },
-- e -- e
{ 'f', builtin.find_files , ' Files' , '[f]ind files' }, { 'f', ts.find_files , ' Files' , '[f]ind files' },
{ 'F', custom.all_files , ' ALL files' , 'all [F]iles' }, { 'F', my.all_files , ' ALL files' , 'all [F]iles' },
{ 'gr', builtin.live_grep , ' Live grep' , 'Live [gr]ep' }, { 'gr', ts.live_grep , ' Live grep' , 'Live [gr]ep' },
{ 'gf', builtin.git_files , ' Git files' , '[g]it [f]iles' }, { 'gf', ts.git_files , ' Git files' , '[g]it [f]iles' },
{ 'gc', builtin.git_commits , ' Commits' , '[g]it [c]ommits' }, { 'gc', ts.git_commits , ' Commits' , '[g]it [c]ommits' },
{ 'h', custom.here , ' Current buffer' , '[b]uffer [h]ere' }, { 'h', my.here , ' Current buffer' , '[b]uffer [h]ere' },
{ 'H', builtin.highlights , '󰌶 Highlights' , '[H]ighlights' }, { 'H', ts.highlights , '󰌶 Highlights' , '[H]ighlights' },
-- i -- i
{ 'j', builtin.jumplist , ' Jumplist' , '[j]umplist' }, { 'j', ts.jumplist , ' Jumplist' , '[j]umplist' },
{ 'k', builtin.keymaps , ' Keymaps' , '[k]eymaps' }, { 'k', ts.keymaps , ' Keymaps' , '[k]eymaps' },
{ 'K', builtin.help_tags , ' Help tags' , '[K] help/documentation' }, { 'K', ts.help_tags , ' Help tags' , '[K] help/documentation' },
{ 'l', builtin.loclist , ' Location list' , '[l]ocation List' }, { 'l', ts.loclist , ' Location list' , '[l]ocation List' },
{ 'm', builtin.man_pages , ' Man pages' , '[m]an pages' }, { 'm', ts.man_pages , ' Man pages' , '[m]an pages' },
-- n -- n
{ 'o', builtin.vim_options , ' Vim options' , 'vim [o]ptions' }, { 'o', ts.vim_options , ' Vim options' , 'vim [o]ptions' },
-- p -- p
{ 'q', builtin.quickfix , ' Quickfix' , '[q]uickfix' }, { 'q', ts.quickfix , ' Quickfix' , '[q]uickfix' },
{ 'r', builtin.registers , '󱓥 Registers' , '[r]registers' }, { 'r', ts.registers , '󱓥 Registers' , '[r]registers' },
{ 'R', builtin.resume , '󰐎 Resume' , '[R]esume' }, { 'R', ts.resume , '󰐎 Resume' , '[R]esume' },
{ 's', custom.selection , '' --[[dynamic]] , '[s]selection' }, { 's', my.selection , '' --[[dynamic]] , '[s]selection' },
{ 't', builtin.treesitter , ' Treesitter symbols' , '[t]reesitter Symbols' }, { 't', ts.treesitter , ' Treesitter symbols' , '[t]reesitter Symbols' },
-- u -- u
-- v -- v
-- w -- w
-- x -- x
-- y -- y
{ 'z', custom.spell_suggest , '󰓆 Spelling suggestions' , '[z] spell suggestions' }, { 'z', my.spell_suggest , '󰓆 Spelling suggestions' , '[z] spell suggestions' },
{ '.', custom.dotfiles , ' Dotfiles' , '[.]dotfiles' }, { '.', my.dotfiles , ' Dotfiles' , '[.]dotfiles' },
{ ':', builtin.command_history, ' Command history' , '[:]command history' }, { ':', ts.command_history , ' Command history' , '[:]command history' },
{ '?', builtin.commands , ' Commands' , 'commands [?]' }, { '?', ts.commands , ' Commands' , 'commands [?]' },
{ '/', builtin.search_history , ' Search history' , '[/]search history' }, { '/', ts.search_history , ' Search history' , '[/]search history' },
}, },
v = { v = {
{ 's', custom.selection , '' --[[dynamic]] , 'visual [s]election' }, { 's', my.selection , '' --[[dynamic]] , 'visual [s]election' },
} }
}) })