From 0238fd14169ced0f5f317c0814b2dbea56c64e56 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 11 Feb 2024 18:33:28 +0100 Subject: [PATCH] vim: minor refactor --- .../nvim/lua/fschauen/plugins/telescope.lua | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 888da03..3437556 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -74,48 +74,52 @@ local pickers = setmetatable({ end }) +local desc = function(text) + return ' Telescope ' .. text +end + M.keys = { - { 'fa', pickers.autocommands ' Autocommands' , desc = ' Telescope [a]utocommands' }, - { 'fb', pickers.buffers ' Buffers' , desc = ' Telescope [b]uffers' }, - { 'fc', pickers.colorscheme ' Colorschemes' , desc = ' Telescope [c]olorschemes' }, - { 'fdd', pickers.diagnostics '󰀪 Document Diagnostics' , desc = ' Telescope [d]iagnostics [d]ocument' }, - { 'fdw', pickers.diagnostics '󰀪 Workspace Diagnostics', desc = ' Telescope [d]iagnostics [w]orkspace' }, + { 'fa', pickers.autocommands ' Autocommands' , desc = desc('[a]utocommands') }, + { 'fb', pickers.buffers ' Buffers' , desc = desc('[b]uffers') }, + { 'fc', pickers.colorscheme ' Colorschemes' , desc = desc('[c]olorschemes') }, + { 'fdd', pickers.diagnostics '󰀪 Document Diagnostics' , desc = desc('[d]iagnostics [d]ocument') }, + { 'fdw', pickers.diagnostics '󰀪 Workspace Diagnostics', desc = desc('[d]iagnostics [w]orkspace') }, --'fe' - { 'ff', pickers.find_files ' Files' , desc = ' Telescope [f]ind files' }, - { 'fF', pickers.all_files ' ALL files' , desc = ' Telescope all [F]iles' }, - { 'fgr', pickers.live_grep ' Live grep' , desc = ' Telescope Live [gr]ep' }, - { 'fgf', pickers.git_files ' Git files' , desc = ' Telescope [g]it [f]iles' }, - { 'fgc', pickers.git_commits ' Commits' , desc = ' Telescope [g]it [c]ommits' }, - { 'fh', pickers.here ' Current buffer' , desc = ' Telescope [b]uffer [h]ere' }, - { 'fH', pickers.highlights '󰌶 Highlights' , desc = ' Telescope [H]ighlights' }, + { 'ff', pickers.find_files ' Files' , desc = desc('[f]ind files') }, + { 'fF', pickers.all_files ' ALL files' , desc = desc('all [F]iles') }, + { 'fgr', pickers.live_grep ' Live grep' , desc = desc('Live [gr]ep') }, + { 'fgf', pickers.git_files ' Git files' , desc = desc('[g]it [f]iles') }, + { 'fgc', pickers.git_commits ' Commits' , desc = desc('[g]it [c]ommits') }, + { 'fh', pickers.here ' Current buffer' , desc = desc('[b]uffer [h]ere') }, + { 'fH', pickers.highlights '󰌶 Highlights' , desc = desc('[H]ighlights') }, --'fi' - { 'fj', pickers.jumplist ' Jumplist' , desc = ' Telescope [j]umplist' }, - { 'fk', pickers.keymaps ' Keymaps' , desc = ' Telescope [k]eymaps' }, - { 'fK', pickers.help_tags ' Help tags' , desc = ' Telescope [K] help/documentation' }, - { 'fl', pickers.loclist ' Location list' , desc = ' Telescope [l]ocation List' }, - { 'fm', pickers.man_pages ' Man pages' , desc = ' Telescope [m]an pages' }, + { 'fj', pickers.jumplist ' Jumplist' , desc = desc('[j]umplist') }, + { 'fk', pickers.keymaps ' Keymaps' , desc = desc('[k]eymaps') }, + { 'fK', pickers.help_tags ' Help tags' , desc = desc('[K] help/documentation') }, + { 'fl', pickers.loclist ' Location list' , desc = desc('[l]ocation List') }, + { 'fm', pickers.man_pages ' Man pages' , desc = desc('[m]an pages') }, --'fn' - { 'fo', pickers.vim_options ' Vim options' , desc = ' Telescope vim [o]ptions' }, + { 'fo', pickers.vim_options ' Vim options' , desc = desc('vim [o]ptions') }, --'fp' - { 'fq', pickers.quickfix ' Quickfix' , desc = ' Telescope [q]uickfix' }, - { 'fr', pickers.lsp_references ' References' , desc = ' Telescope [r]eferences' }, - { 'fR', pickers.registers '󱓥 Registers' , desc = ' Telescope [R]registers' }, - { 'fs', pickers.lsp_document_symbols '󰫧 Document Symbols ' , desc = ' Telescope lsp document [s]ymbols' }, - { 'fS', pickers.lsp_workspace_symbols '󱄑 Workspace Symbols ' , desc = ' Telescope lsp workspace [S]ymbols' }, + { 'fq', pickers.quickfix ' Quickfix' , desc = desc('[q]uickfix') }, + { 'fr', pickers.lsp_references ' References' , desc = desc('[r]eferences') }, + { 'fR', pickers.registers '󱓥 Registers' , desc = desc('[R]registers') }, + { 'fs', pickers.lsp_document_symbols '󰫧 Document Symbols ' , desc = desc('lsp document [s]ymbols') }, + { 'fS', pickers.lsp_workspace_symbols '󱄑 Workspace Symbols ' , desc = desc('lsp workspace [S]ymbols') }, --'ft' used in todo_comments - { 'fT', pickers.treesitter ' Treesitter symbols' , desc = ' Telescope [T]reesitter Symbols' }, + { 'fT', pickers.treesitter ' Treesitter symbols' , desc = desc('[T]reesitter Symbols') }, --'fu' --'fv' - { 'fw', pickers.selection ' Grep' , desc = ' Telescope [w]word under cursor' }, - { 'fw', pickers.selection ' Grep', mode = 'v' , desc = ' Telescope [w]ord(s) selected' }, + { 'fw', pickers.selection ' Grep' , desc = desc('[w]word under cursor') }, + { 'fw', pickers.selection ' Grep', mode = 'v' , desc = desc('[w]ord(s) selected') }, --'fx' --'fy' - { 'fz', pickers.spell_suggest '󰓆 Spelling suggestions' , desc = ' Telescope [z] spell suggestions' }, - { 'f.', pickers.dotfiles ' Dotfiles' , desc = ' Telescope [.]dotfiles' }, - { 'f:', pickers.command_history ' Command history' , desc = ' Telescope [:]command history' }, - { 'f?', pickers.commands ' Commands' , desc = ' Telescope commands [?]' }, - { 'f/', pickers.search_history ' Search history' , desc = ' Telescope [/]search history' }, - { 'f', pickers.resume '󰐎 Resume' , desc = ' Telescope Resume ' }, + { 'fz', pickers.spell_suggest '󰓆 Spelling suggestions' , desc = desc('[z] spell suggestions') }, + { 'f.', pickers.dotfiles ' Dotfiles' , desc = desc('[.]dotfiles') }, + { 'f:', pickers.command_history ' Command history' , desc = desc('[:]command history') }, + { 'f?', pickers.commands ' Commands' , desc = desc('commands [?]') }, + { 'f/', pickers.search_history ' Search history' , desc = desc('[/]search history') }, + { 'f', pickers.resume '󰐎 Resume' , desc = desc('Resume ') }, } local icons = require('fschauen.icons')