diff --git a/config/nvim/lua/fschauen/keymap.lua b/config/nvim/lua/fschauen/keymap.lua index aff0aeb..c94407a 100644 --- a/config/nvim/lua/fschauen/keymap.lua +++ b/config/nvim/lua/fschauen/keymap.lua @@ -2,7 +2,6 @@ local M = {} local diagnostic = require 'fschauen.diagnostic' local window = require 'fschauen.window' -local pick = require('fschauen.telescope').pickers local toggle_number = function() vim.wo.number = not vim.wo.number @@ -14,14 +13,6 @@ local toggle_relativenumber = function() vim.wo.number = vim.wo.relativenumber or vim.wo.number end -local toggle_colorcolumn = function() - if vim.o.colorcolumn == '' then - vim.o.colorcolumn = '+1' -- one after 'textwidth' - else - vim.o.colorcolumn = '' -- none - end -end - local keymap = { -- better navigation for wrapped lines { 'j', 'gj' }, @@ -92,68 +83,6 @@ local keymap = { { 'do', diagnostic.open_float }, { 'dh', diagnostic.hide }, - telescope_file_browser = { - { 'fB', 'Telescope file_browser' , desc = ' file [B]rowser' }, - }, - - telescope = { - { 'fa', pick.autocommands ' Autocommands' , desc = ' Telescope [a]utocommands' }, - { 'fb', pick.buffers ' Buffers' , desc = ' Telescope [b]uffers' }, - { 'fc', pick.colorscheme ' Colorschemes' , desc = ' Telescope [c]olorschemes' }, - { 'fdd', pick.diagnostics '󰀪 Document Diagnostics' , desc = ' Telescope [d]iagnostics [d]ocument' }, - { 'fdw', pick.diagnostics '󰀪 Workspace Diagnostics', desc = ' Telescope [d]iagnostics [w]orkspace' }, - --'fe' - { 'ff', pick.find_files ' Files' , desc = ' Telescope [f]ind files' }, - { 'fF', pick.all_files ' ALL files' , desc = ' Telescope all [F]iles' }, - { 'fgr', pick.live_grep ' Live grep' , desc = ' Telescope Live [gr]ep' }, - { 'fgf', pick.git_files ' Git files' , desc = ' Telescope [g]it [f]iles' }, - { 'fgc', pick.git_commits ' Commits' , desc = ' Telescope [g]it [c]ommits' }, - { 'fh', pick.here ' Current buffer' , desc = ' Telescope [b]uffer [h]ere' }, - { 'fH', pick.highlights '󰌶 Highlights' , desc = ' Telescope [H]ighlights' }, - --'fi' - { 'fj', pick.jumplist ' Jumplist' , desc = ' Telescope [j]umplist' }, - { 'fk', pick.keymaps ' Keymaps' , desc = ' Telescope [k]eymaps' }, - { 'fK', pick.help_tags ' Help tags' , desc = ' Telescope [K] help/documentation' }, - { 'fl', pick.loclist ' Location list' , desc = ' Telescope [l]ocation List' }, - { 'fm', pick.man_pages ' Man pages' , desc = ' Telescope [m]an pages' }, - --'fn' - { 'fo', pick.vim_options ' Vim options' , desc = ' Telescope vim [o]ptions' }, - --'fp' - { 'fq', pick.quickfix ' Quickfix' , desc = ' Telescope [q]uickfix' }, - { 'fr', pick.lsp_references ' References' , desc = ' Telescope [r]eferences' }, - { 'fR', pick.registers '󱓥 Registers' , desc = ' Telescope [R]registers' }, - { 'fs', pick.lsp_document_symbols '󰫧 Document Symbols ' , desc = ' Telescope lsp document [s]ymbols' }, - { 'fS', pick.lsp_workspace_symbols '󱄑 Workspace Symbols ' , desc = ' Telescope lsp workspace [S]ymbols' }, - --'ft' used in todo_comments below - { 'fT', pick.treesitter ' Treesitter symbols' , desc = ' Telescope [T]reesitter Symbols' }, - --'fu' - --'fv' - { 'fw', pick.selection ' Grep' , desc = ' Telescope [w]word under cursor' }, - { 'fw', pick.selection ' Grep', mode = 'v' , desc = ' Telescope [w]ord(s) selected' }, - --'fx' - --'fy' - { 'fz', pick.spell_suggest '󰓆 Spelling suggestions' , desc = ' Telescope [z] spell suggestions' }, - { 'f.', pick.dotfiles ' Dotfiles' , desc = ' Telescope [.]dotfiles' }, - { 'f:', pick.command_history ' Command history' , desc = ' Telescope [:]command history' }, - { 'f?', pick.commands ' Commands' , desc = ' Telescope commands [?]' }, - { 'f/', pick.search_history ' Search history' , desc = ' Telescope [/]search history' }, - { 'f', pick.resume '󰐎 Resume' , desc = ' Telescope Resume ' }, - }, - - todo_comments = { - { 'ft', 'TodoTelescope' }, - }, - - fugitive = { - { 'gg', ':Git ' }, - { 'gs', 'tab Git' }, - { 'gb', 'Git blame' } - }, - - neogit = { - { 'gn', 'Neogit' }, - }, - -- disable highlight until next search { 'h', 'nohlsearch' }, @@ -167,52 +96,15 @@ local keymap = { { 'll', window.toggle_quickfix, desc = 'Toggle quickfix' }, { 'll', window.toggle_loclist, desc = 'Toggle loclist' }, - trouble = { - { 'lt', 'TroubleToggle' }, - { 'lw', 'TroubleToggle workspace_diagnostics' }, - { 'ld', 'TroubleToggle document_diagnostics' }, - }, - -- quickly open lazy.nvim plugin manager { 'L', 'Lazy' }, - nvim_tree = { - { 'nn', 'NvimTreeOpen' }, - { 'nf', 'NvimTreeFindFile' }, - { 'nc', 'NvimTreeClose' }, - }, - -- toggle options { 'sn', toggle_number }, { 'sr', toggle_relativenumber }, { 'sl', 'set list! | set list?' }, { 'sw', 'set wrap! | set wrap?' }, { 'ss', 'set spell! | set spell?' }, - - virt_column = { - { 'sc', toggle_colorcolumn, desc = 'Toggle virtual colunn' }, - }, - - indent_blankline = { - { 'si', 'IndentBlanklineToggle' }, - }, - - treesitter = { - { 'tp', 'TSPlaygroundToggle' }, - { 'th', 'TSHighlightCapturesUnderCursor' }, - { 'tn', 'TSNodeUnderCursor' }, - }, - - undotree = { - { 'u', 'UndotreeToggle' }, - }, - - whitespace ={ - { 'ww', 'ToggleWhitespace' }, - { 'wj', 'NextTrailingWhitespace' }, - { 'wk', 'PrevTrailingWhitespace' }, - { 'wd', 'StripWhitespace' }, - }, } M.setup = function() diff --git a/config/nvim/lua/fschauen/plugins/comment.lua b/config/nvim/lua/fschauen/plugins/comment.lua index a05ae6f..ef55fe4 100644 --- a/config/nvim/lua/fschauen/plugins/comment.lua +++ b/config/nvim/lua/fschauen/plugins/comment.lua @@ -3,9 +3,9 @@ local M = { 'tpope/vim-commentary' } M.cmd = 'Commentary' M.keys = { - { 'gc', 'Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' }, - { 'gcc', 'CommentaryLine', desc = 'Comment in/out line' }, - { 'gcu', 'CommentaryCommentary', desc = 'Undo comment in/out' }, + { 'gc', 'Commentary', mode = { 'n', 'x', 'o' }, desc = 'Comment in/out' }, + { 'gcc', 'CommentaryLine', desc = 'Comment in/out line' }, + { 'gcu', 'CommentaryCommentary', desc = 'Undo comment in/out' }, } return M diff --git a/config/nvim/lua/fschauen/plugins/fugitive.lua b/config/nvim/lua/fschauen/plugins/fugitive.lua index 8dd0b56..fd961bc 100644 --- a/config/nvim/lua/fschauen/plugins/fugitive.lua +++ b/config/nvim/lua/fschauen/plugins/fugitive.lua @@ -5,7 +5,11 @@ M.cmd = { 'Git', } -M.keys = require('fschauen.keymap').fugitive +M.keys = { + { 'gg', ':Git ' }, + { 'gs', 'tab Git' }, + { 'gb', 'Git blame' } +} return M diff --git a/config/nvim/lua/fschauen/plugins/indent-blankline.lua b/config/nvim/lua/fschauen/plugins/indent-blankline.lua index 4382f6a..40b0963 100644 --- a/config/nvim/lua/fschauen/plugins/indent-blankline.lua +++ b/config/nvim/lua/fschauen/plugins/indent-blankline.lua @@ -1,6 +1,8 @@ local M = { 'lukas-reineke/indent-blankline.nvim' } -M.keys = require('fschauen.keymap').indent_blankline +M.keys = { + { 'si', 'IndentBlanklineToggle' }, +} M.lazy = false -- trows an error when lazy loading diff --git a/config/nvim/lua/fschauen/plugins/neogit.lua b/config/nvim/lua/fschauen/plugins/neogit.lua index 01b0b99..d961524 100644 --- a/config/nvim/lua/fschauen/plugins/neogit.lua +++ b/config/nvim/lua/fschauen/plugins/neogit.lua @@ -4,7 +4,9 @@ M.dependencies = { 'nvim-lua/plenary.nvim', } -M.keys = require('fschauen.keymap').neogit +M.keys = { + { 'gn', 'Neogit' }, +} M.opts = { disable_hint = true, diff --git a/config/nvim/lua/fschauen/plugins/nvim-tree.lua b/config/nvim/lua/fschauen/plugins/nvim-tree.lua index 547b2e6..88c30ae 100644 --- a/config/nvim/lua/fschauen/plugins/nvim-tree.lua +++ b/config/nvim/lua/fschauen/plugins/nvim-tree.lua @@ -4,7 +4,11 @@ M.dependencies = { 'nvim-tree/nvim-web-devicons', } -M.keys = require('fschauen.keymap').nvim_tree +M.keys = { + { 'nn', 'NvimTreeOpen' }, + { 'nf', 'NvimTreeFindFile' }, + { 'nc', 'NvimTreeClose' }, +} M.opts = { disable_netrw = true, -- replace netrw with nvim-tree diff --git a/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua b/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua index 0996aa7..583cff5 100644 --- a/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua +++ b/config/nvim/lua/fschauen/plugins/telescope-file-browser.lua @@ -4,7 +4,9 @@ M.dependencies = { 'nvim-telescope/telescope.nvim', } -M.keys = require('fschauen.keymap').telescope_file_browser +M.keys = { + { 'fB', 'Telescope file_browser' , desc = ' file [B]rowser' }, +} M.config = function() require('telescope').load_extension 'file_browser' diff --git a/config/nvim/lua/fschauen/plugins/telescope.lua b/config/nvim/lua/fschauen/plugins/telescope.lua index 58454fa..54e8255 100644 --- a/config/nvim/lua/fschauen/plugins/telescope.lua +++ b/config/nvim/lua/fschauen/plugins/telescope.lua @@ -9,7 +9,50 @@ M.dependencies = { M.cmd = 'Telescope' -M.keys = require('fschauen.keymap').telescope +local pick = require('fschauen.telescope').pickers +M.keys = { + { 'fa', pick.autocommands ' Autocommands' , desc = ' Telescope [a]utocommands' }, + { 'fb', pick.buffers ' Buffers' , desc = ' Telescope [b]uffers' }, + { 'fc', pick.colorscheme ' Colorschemes' , desc = ' Telescope [c]olorschemes' }, + { 'fdd', pick.diagnostics '󰀪 Document Diagnostics' , desc = ' Telescope [d]iagnostics [d]ocument' }, + { 'fdw', pick.diagnostics '󰀪 Workspace Diagnostics', desc = ' Telescope [d]iagnostics [w]orkspace' }, + --'fe' + { 'ff', pick.find_files ' Files' , desc = ' Telescope [f]ind files' }, + { 'fF', pick.all_files ' ALL files' , desc = ' Telescope all [F]iles' }, + { 'fgr', pick.live_grep ' Live grep' , desc = ' Telescope Live [gr]ep' }, + { 'fgf', pick.git_files ' Git files' , desc = ' Telescope [g]it [f]iles' }, + { 'fgc', pick.git_commits ' Commits' , desc = ' Telescope [g]it [c]ommits' }, + { 'fh', pick.here ' Current buffer' , desc = ' Telescope [b]uffer [h]ere' }, + { 'fH', pick.highlights '󰌶 Highlights' , desc = ' Telescope [H]ighlights' }, + --'fi' + { 'fj', pick.jumplist ' Jumplist' , desc = ' Telescope [j]umplist' }, + { 'fk', pick.keymaps ' Keymaps' , desc = ' Telescope [k]eymaps' }, + { 'fK', pick.help_tags ' Help tags' , desc = ' Telescope [K] help/documentation' }, + { 'fl', pick.loclist ' Location list' , desc = ' Telescope [l]ocation List' }, + { 'fm', pick.man_pages ' Man pages' , desc = ' Telescope [m]an pages' }, + --'fn' + { 'fo', pick.vim_options ' Vim options' , desc = ' Telescope vim [o]ptions' }, + --'fp' + { 'fq', pick.quickfix ' Quickfix' , desc = ' Telescope [q]uickfix' }, + { 'fr', pick.lsp_references ' References' , desc = ' Telescope [r]eferences' }, + { 'fR', pick.registers '󱓥 Registers' , desc = ' Telescope [R]registers' }, + { 'fs', pick.lsp_document_symbols '󰫧 Document Symbols ' , desc = ' Telescope lsp document [s]ymbols' }, + { 'fS', pick.lsp_workspace_symbols '󱄑 Workspace Symbols ' , desc = ' Telescope lsp workspace [S]ymbols' }, + --'ft' used in todo_comments + { 'fT', pick.treesitter ' Treesitter symbols' , desc = ' Telescope [T]reesitter Symbols' }, + --'fu' + --'fv' + { 'fw', pick.selection ' Grep' , desc = ' Telescope [w]word under cursor' }, + { 'fw', pick.selection ' Grep', mode = 'v' , desc = ' Telescope [w]ord(s) selected' }, + --'fx' + --'fy' + { 'fz', pick.spell_suggest '󰓆 Spelling suggestions' , desc = ' Telescope [z] spell suggestions' }, + { 'f.', pick.dotfiles ' Dotfiles' , desc = ' Telescope [.]dotfiles' }, + { 'f:', pick.command_history ' Command history' , desc = ' Telescope [:]command history' }, + { 'f?', pick.commands ' Commands' , desc = ' Telescope commands [?]' }, + { 'f/', pick.search_history ' Search history' , desc = ' Telescope [/]search history' }, + { 'f', pick.resume '󰐎 Resume' , desc = ' Telescope Resume ' }, +} M.opts = function() local actions = require('telescope.actions') diff --git a/config/nvim/lua/fschauen/plugins/todo-comments.lua b/config/nvim/lua/fschauen/plugins/todo-comments.lua index dabf5c5..74e2308 100644 --- a/config/nvim/lua/fschauen/plugins/todo-comments.lua +++ b/config/nvim/lua/fschauen/plugins/todo-comments.lua @@ -2,15 +2,18 @@ local M = { 'folke/todo-comments.nvim' } M.dependencies = { 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', } -M.keys = require('fschauen.keymap').todo_comments - M.event = { 'BufReadPost', 'BufNewFile' } +M.keys = { + { 'ft', 'TodoTelescope' }, +} + M.opts = { keywords = { TODO = { icon = '󰄬 ' }, diff --git a/config/nvim/lua/fschauen/plugins/treesitter.lua b/config/nvim/lua/fschauen/plugins/treesitter.lua index a909322..7a50809 100644 --- a/config/nvim/lua/fschauen/plugins/treesitter.lua +++ b/config/nvim/lua/fschauen/plugins/treesitter.lua @@ -6,8 +6,6 @@ M.dependencies = { 'nvim-treesitter/playground', } -M.keys = require('fschauen.keymap').treesitter - M.event = { 'BufReadPost', 'BufNewFile' @@ -23,6 +21,12 @@ M.cmd = { 'TSInstallFromGrammar', } +M.keys = { + { 'tp', 'TSPlaygroundToggle' }, + { 'th', 'TSHighlightCapturesUnderCursor' }, + { 'tn', 'TSNodeUnderCursor' }, +} + M.main = 'nvim-treesitter.configs' M.opts = { diff --git a/config/nvim/lua/fschauen/plugins/trouble.lua b/config/nvim/lua/fschauen/plugins/trouble.lua index e432e99..73d57a0 100644 --- a/config/nvim/lua/fschauen/plugins/trouble.lua +++ b/config/nvim/lua/fschauen/plugins/trouble.lua @@ -4,7 +4,11 @@ M.dependencies = { 'nvim-tree/nvim-web-devicons', } -M.keys = require('fschauen.keymap').trouble +M.keys = { + { 'lt', 'TroubleToggle' }, + { 'lw', 'TroubleToggle workspace_diagnostics' }, + { 'ld', 'TroubleToggle document_diagnostics' }, +} M.opts = { padding = false, -- don't add an extra new line of top of the list diff --git a/config/nvim/lua/fschauen/plugins/undotree.lua b/config/nvim/lua/fschauen/plugins/undotree.lua index f163f03..ef55582 100644 --- a/config/nvim/lua/fschauen/plugins/undotree.lua +++ b/config/nvim/lua/fschauen/plugins/undotree.lua @@ -10,7 +10,9 @@ M.init = function() vim.g.undotree_TreeReturnShape = '╲' end -M.keys = require('fschauen.keymap').undotree +M.keys = { + { 'u', 'UndotreeToggle' }, +} M.config = false diff --git a/config/nvim/lua/fschauen/plugins/virt-column.lua b/config/nvim/lua/fschauen/plugins/virt-column.lua index 3c0829d..023631f 100644 --- a/config/nvim/lua/fschauen/plugins/virt-column.lua +++ b/config/nvim/lua/fschauen/plugins/virt-column.lua @@ -5,7 +5,17 @@ M.event = { 'BufNewFile' } -M.keys = require('fschauen.keymap').virt_column +local toggle_colorcolumn = function() + if vim.o.colorcolumn == '' then + vim.o.colorcolumn = '+1' -- one after 'textwidth' + else + vim.o.colorcolumn = '' -- none + end +end + +M.keys = { + { 'sc', toggle_colorcolumn, desc = 'Toggle virtual colunn' }, +} M.opts = { char = '│', diff --git a/config/nvim/lua/fschauen/plugins/whitespace.lua b/config/nvim/lua/fschauen/plugins/whitespace.lua index 0e2bb75..033adac 100644 --- a/config/nvim/lua/fschauen/plugins/whitespace.lua +++ b/config/nvim/lua/fschauen/plugins/whitespace.lua @@ -10,13 +10,18 @@ M.init = function() } end -M.keys = require('fschauen.keymap').whitespace - M.event = { 'BufReadPost', 'BufNewFile' } +M.keys = { + { 'ww', 'ToggleWhitespace' }, + { 'wj', 'NextTrailingWhitespace' }, + { 'wk', 'PrevTrailingWhitespace' }, + { 'wd', 'StripWhitespace' }, +} + M.config = false return M