diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..5d12dbd --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,6 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +no_call_parentheses = true diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index 41edecc..b7b9666 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -33,6 +33,12 @@ return require('packer').startup(function(use) require('plugins.fidget-nvim') end, } + use { + "folke/neodev.nvim", + config = function() + require('plugins.neodev-nvim') + end, + } use { 'hrsh7th/nvim-cmp', requires = { diff --git a/lua/plugins/drex-nvim.lua b/lua/plugins/drex-nvim.lua index 1bf3f9b..9d608ee 100644 --- a/lua/plugins/drex-nvim.lua +++ b/lua/plugins/drex-nvim.lua @@ -2,7 +2,7 @@ local drex = require('drex') local elements = require('drex.elements') -- open the home directory -vim.keymap.set('n', '~', 'Drex ~', {}) +vim.keymap.set('n', '~', 'Drex ~', { desc = "Open home [~] directory in drex" }) -- open parent DREX buffer and focus current file vim.keymap.set('n', '-', function() local path = vim.fn.expand('%:p') @@ -12,7 +12,7 @@ vim.keymap.set('n', '-', function() drex.open_directory_buffer(vim.fn.fnamemodify(path, ':h')) elements.focus_element(0, path) end -end, {}) +end, { desc = "Open current directory in drex" }) require('drex.config').configure({ hijack_netrw = true, diff --git a/lua/plugins/fugitive.lua b/lua/plugins/fugitive.lua index 4711d1b..be12d3e 100644 --- a/lua/plugins/fugitive.lua +++ b/lua/plugins/fugitive.lua @@ -1,11 +1,11 @@ -vim.keymap.set('n', 'gx', [[G]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gs', [[Git]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gd', [[Gdiff]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gc', [[Gcommit]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gb', [[Git blame -C]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gp', [[Git push]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gf', [[Git push --force]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gu', [[Git pull]], { noremap = false, silent = true }) -vim.keymap.set('n', 'gh', [[Git diff --cached]], { noremap = false, silent = true }) -vim.keymap.set('n', 'go', [[GBrowse]], { noremap = false, silent = true }) -vim.keymap.set('v', 'go', [['<,'>GBrowse]], { noremap = false, silent = true }) +vim.keymap.set('n', 'gx', [[G]], { noremap = false, silent = true, desc = "Toggle [G]it status window" }) +vim.keymap.set('n', 'gs', [[Git]], { noremap = false, silent = true, desc = "Toggle [G]it [S]tatus window" }) +vim.keymap.set('n', 'gd', [[Gdiffsplit]], { noremap = false, silent = true, desc = "[G]it [D]iff current file against index" }) +vim.keymap.set('n', 'gc', [[Git commit]], { noremap = false, silent = true, desc = "[G]it [C]ommit" }) +vim.keymap.set('n', 'gb', [[Git blame -C]], { noremap = false, silent = true, desc = "[G]it [B]lame" }) +vim.keymap.set('n', 'gp', [[Git push]], { noremap = false, silent = true, desc = "[G]it [P]ush" }) +vim.keymap.set('n', 'gf', [[Git push --force]], { noremap = false, silent = true, desc = "[G]it [F]orce push" }) +vim.keymap.set('n', 'gu', [[Git pull]], { noremap = false, silent = true, desc = "[G]it p[U]ll" }) +vim.keymap.set('n', 'gh', [[Git diff --cached]], { noremap = false, silent = true, desc = "[G]it diff current staged changes" }) +vim.keymap.set('n', 'go', [[GBrowse]], { noremap = false, silent = true, desc = "[B]rowse [G]it URL for fugitive object under cursor" }) +vim.keymap.set('v', 'go', [['<,'>GBrowse]], { noremap = false, silent = true, desc = "[B]rowse [G]it URL for selected lines" }) diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua index 0774495..2c8c08f 100644 --- a/lua/plugins/gitsigns.lua +++ b/lua/plugins/gitsigns.lua @@ -14,28 +14,28 @@ require('gitsigns').setup({ if vim.wo.diff then return ']c' end vim.schedule(function() gs.next_hunk() end) return '' - end, {expr=true}) + end, { expr = true, desc = "Jump to next git hunk [C]hange" }) map('n', '[c', function() if vim.wo.diff then return '[c' end vim.schedule(function() gs.prev_hunk() end) return '' - end, {expr=true}) + end, { expr = true, desc = "Jump to previous git hunk [C]hange" }) -- Actions - map({'n', 'v'}, 'hs', ':Gitsigns stage_hunk') - map({'n', 'v'}, 'hr', ':Gitsigns reset_hunk') - map('n', 'hS', gs.stage_buffer) - map('n', 'hu', gs.undo_stage_hunk) - map('n', 'hR', gs.reset_buffer) - map('n', 'hp', gs.preview_hunk) - map('n', 'hb', function() gs.blame_line{full=true} end) - map('n', 'tb', gs.toggle_current_line_blame) - map('n', 'hd', gs.diffthis) - map('n', 'hD', function() gs.diffthis('~') end) - map('n', 'td', gs.toggle_deleted) + map({ 'n', 'v' }, 'hs', ':Gitsigns stage_hunk', { desc = "[S]tage git [H]unk" }) + map({ 'n', 'v' }, 'hr', ':Gitsigns reset_hunk', { desc = "[R]eset git [H]unk" }) + map('n', 'hS', gs.stage_buffer, { desc = "[S]tage git buffer" }) + map('n', 'hu', gs.undo_stage_hunk, { desc = "[U]ndo git [H]unk" }) + map('n', 'hR', gs.reset_buffer, { desc = "[R]eset git buffer" }) + map('n', 'hp', gs.preview_hunk, { desc = "[P]review git [H]unk" }) + map('n', 'hb', function() gs.blame_line { full = true } end, { desc = "Git [B]lame line" }) + map('n', 'tb', gs.toggle_current_line_blame, { desc = "[T]oggle current line git [B]lame" }) + map('n', 'hd', gs.diffthis, { desc = "Git [D]iff current file with index" }) + map('n', 'hD', function() gs.diffthis('~') end, { desc = "Git [D]iff current file with last commit" }) + map('n', 'td', gs.toggle_deleted, { desc = "[T]oggle showing [D]eleted git hunks" }) -- Text object - map({'o', 'x'}, 'ih', ':Gitsigns select_hunk') + map({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk', { desc = "Select git [H]unk under cursor" }) end }) diff --git a/lua/plugins/gui-font-resize-nvim.lua b/lua/plugins/gui-font-resize-nvim.lua index de33539..cee4c31 100644 --- a/lua/plugins/gui-font-resize-nvim.lua +++ b/lua/plugins/gui-font-resize-nvim.lua @@ -3,6 +3,6 @@ require('gui-font-resize').setup({ change_by = 1, -- step value that will inc/dec the fontsize by }) -vim.keymap.set('n', '', [[GUIFontSizeUp]], { noremap = true, silent = true}) -vim.keymap.set('n', '', [[GUIFontSizeDown]], { noremap = true, silent = true}) -vim.keymap.set('n', '', [[set guifont=Hack:h11 | GUIFontSizeSet]], { noremap = true, silent = true}) +vim.keymap.set('n', '', [[GUIFontSizeUp]], { noremap = true, silent = true, desc = "Increase font size" }) +vim.keymap.set('n', '', [[GUIFontSizeDown]], { noremap = true, silent = true, desc = "Decrease font size" }) +vim.keymap.set('n', '', [[set guifont=Hack:h11 | GUIFontSizeSet]], { noremap = true, silent = true, desc = "Set font family and size to default" }) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 4224eb2..15613f8 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -50,6 +50,9 @@ require('lspconfig')['sumneko_lua'].setup({ flags = lsp_flags, settings = { Lua = { + completion = { + callSnippet = "Replace" + }, runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = 'LuaJIT', diff --git a/lua/plugins/neodev-nvim.lua b/lua/plugins/neodev-nvim.lua new file mode 100644 index 0000000..d14885b --- /dev/null +++ b/lua/plugins/neodev-nvim.lua @@ -0,0 +1 @@ +require('neodev').setup({}) diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index 857f495..cf46fd6 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -5,12 +5,12 @@ neotest.setup({ }, }) -vim.keymap.set("n", "t", function() neotest.run.run() end) -vim.keymap.set("n", "tf", function() neotest.run.run(vim.fn.expand('%')) end) -vim.keymap.set("n", "tt", function() neotest.run.run({ strategy = 'dap' }) end) -vim.keymap.set("n", "ta", function() neotest.run.attach() end) -vim.keymap.set("n", "to", function() neotest.output.open({ enter = true }) end) -vim.keymap.set("n", "ts", function() neotest.summary.toggle() end) +vim.keymap.set("n", "t", function() neotest.run.run() end, { desc = "Run neo[T]ests under cursor"}) +vim.keymap.set("n", "tf", function() neotest.run.run(vim.fn.expand('%')) end, { desc = "Run neo[T]ests in current file" }) +vim.keymap.set("n", "tt", function() neotest.run.run({ strategy = 'dap' }) end, { desc = "Run neo[T]ests in DAP debugging mode" }) +vim.keymap.set("n", "ta", function() neotest.run.attach() end, { desc = "[A]ttach to neo[T]est process" }) +vim.keymap.set("n", "to", function() neotest.output.open({ enter = true }) end, { desc = "[O]pen neo[T]ests summary window" }) +vim.keymap.set("n", "ts", function() neotest.summary.toggle() end, { desc = "Toggle neo[T]est [S]ummary window"}) vim.diagnostic.config({ neotest = true, diff --git a/lua/plugins/nvim-dap.lua b/lua/plugins/nvim-dap.lua index e1453b7..0e12f8e 100644 --- a/lua/plugins/nvim-dap.lua +++ b/lua/plugins/nvim-dap.lua @@ -21,7 +21,7 @@ local dap = require('dap') -- }, -- } -vim.keymap.set('n', 'b', [[lua require('dap').toggle_breakpoint()]]) -vim.keymap.set('n', 'be', [[lua require('dap').set_exception_breakpoints()]]) -vim.keymap.set('n', 'bc', [[lua require('dap').clear_breakpoints()]]) -vim.keymap.set('n', 'bo', [[lua require('dapui').toggle()]]) +vim.keymap.set('n', 'b', [[lua require('dap').toggle_breakpoint()]], { desc = "Toggle DAP [B]reakpoint"}) +vim.keymap.set('n', 'be', [[lua require('dap').set_exception_breakpoints()]], { desc = "Toggle DAP [B]reak on [E]xceptions" }) +vim.keymap.set('n', 'bc', [[lua require('dap').clear_breakpoints()]], { desc = "[C]lear DAP [B]reakpoints" }) +vim.keymap.set('n', 'bo', [[lua require('dapui').toggle()]], { desc = "Toggle nvim dapui" }) diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index 71eb744..513549f 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -28,4 +28,4 @@ require('nvim-tree').setup({ -- swapping this out with drex.nvim instead -- vim.keymap.set('n', '-', function() toggle_replace() end, { noremap = true, silent = true }) -vim.keymap.set('n', 'n', [[NvimTreeToggle]], { noremap = true, silent = true }) +vim.keymap.set('n', 'n', [[NvimTreeToggle]], { noremap = true, silent = true, desc = "Toggle [N]vim Tree" }) diff --git a/lua/plugins/nvim-treesitter.lua b/lua/plugins/nvim-treesitter.lua index b485a00..5088b9e 100644 --- a/lua/plugins/nvim-treesitter.lua +++ b/lua/plugins/nvim-treesitter.lua @@ -11,10 +11,10 @@ require('nvim-treesitter.configs').setup { incremental_selection = { enable = true, keymaps = { - init_selection = "gnn", - node_incremental = "grn", - scope_incremental = "grc", - node_decremental = "grm", + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", }, }, indent = { @@ -23,8 +23,11 @@ require('nvim-treesitter.configs').setup { textobjects = { select = { enable = true, - lookahead = true, + lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', ['af'] = '@function.outer', ['if'] = '@function.inner', ['ac'] = '@class.outer', @@ -32,6 +35,35 @@ require('nvim-treesitter.configs').setup { } } }, + move = { + enable = true, + set_jumps = true, -- whether to set jumps in the jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']]'] = '@class.outer', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']['] = '@class.outer', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[['] = '@class.outer', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[]'] = '@class.outer', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, autotag = { enable = true, }, diff --git a/lua/plugins/rest-nvim.lua b/lua/plugins/rest-nvim.lua index 0ac7569..e1714fd 100644 --- a/lua/plugins/rest-nvim.lua +++ b/lua/plugins/rest-nvim.lua @@ -2,6 +2,6 @@ require('rest-nvim').setup({ skip_ssl_verification = true, }) -vim.keymap.set('n', 'rd', [[RestNvim]], { noremap = false, silent = true }) -vim.keymap.set('n', 'ry', [[RestNvimPreview]], { noremap = false, silent = true }) +vim.keymap.set('n', 'rd', [[RestNvim]], { noremap = false, silent = true, desc = "Run rest.nvim under cursor" }) +vim.keymap.set('n', 'ry', [[RestNvimPreview]], { noremap = false, silent = true, desc = "Show cURL command for rest.nvim under cursor"}) vim.keymap.set('n', 'ri', [[RestNvimLast]], { noremap = false, silent = true }) diff --git a/lua/plugins/rust-tools-nvim.lua b/lua/plugins/rust-tools-nvim.lua index 392fffd..0963ac9 100644 --- a/lua/plugins/rust-tools-nvim.lua +++ b/lua/plugins/rust-tools-nvim.lua @@ -16,12 +16,12 @@ rt.setup({ capabilities = nvim_cmp_capabilities, on_attach = function(client, bufnr) lsp_on_attach(client, bufnr) - vim.keymap.set('n', '', rt.hover_actions.hover_actions, { buffer = bufnr }) + vim.keymap.set('n', '', rt.hover_actions.hover_actions, { buffer = bufnr, desc = "Show hover actions under cursor" }) -- Code action groups - vim.keymap.set('n', 'a', rt.code_action_group.code_action_group, { buffer = bufnr }) - vim.keymap.set('n', 'rc', rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr }) - vim.keymap.set('n', 'rp', rt.parent_module.parent_module, { buffer = bufnr }) - vim.keymap.set('n', 'rm', rt.expand_macro.expand_macro, { buffer = bufnr }) + vim.keymap.set('n', 'a', rt.code_action_group.code_action_group, { buffer = bufnr, desc = "Show code actions under cursor" }) + vim.keymap.set('n', 'rc', rt.open_cargo_toml.open_cargo_toml, { buffer = bufnr, desc = "Open Cargo.toml for current project" }) + vim.keymap.set('n', 'rp', rt.parent_module.parent_module, { buffer = bufnr, desc = "Go to parent Rust module" }) + vim.keymap.set('n', 'rm', rt.expand_macro.expand_macro, { buffer = bufnr, desc = "Expand Rust macro" }) end, settings = { -- to enable rust-analyzer settings visit: diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 26d49ab..e4f9c21 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -33,131 +33,131 @@ vim.keymap.set( 'n', '', [[lua require('telescope.builtin').git_files({ show_untracked = true })]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Find git files" } ) vim.keymap.set( 'n', 'f.', [[lua require('telescope.builtin').git_files({ no_ignore = true })]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind ALL git files including ignored [.]" } ) vim.keymap.set( 'n', '_', [[lua require('telescope.builtin').live_grep()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Search by live grep" } ) vim.keymap.set( 'n', '_', [[lua require('telescope.builtin').live_grep({ search_dirs = { vim.fn.expand('%:p:h') } })]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Search by live grep in current (present) working directory" } ) vim.keymap.set( 'n', '8', [[lua require('telescope.builtin').grep_string()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Search by grep" } ) vim.keymap.set( 'n', '3', [[lua require('telescope.builtin').grep_string()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Search by grep" } ) vim.keymap.set( "n", "fd", [[lua require('telescope.builtin').find_files({cwd=require('telescope.utils').buffer_dir()})]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [D]irectories" } ) vim.keymap.set( 'n', 'fb', [[lua require('telescope.builtin').buffers()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [B]uffers" } ) vim.keymap.set( 'n', 'fh', [[lua require('telescope.builtin').help_tags()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [T]ags" } ) vim.keymap.set( 'n', 'ft', [[lua require('telescope.builtin').treesitter()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [T]reesitter objects" } ) vim.keymap.set( 'n', 'fr', [[lua require('telescope.builtin').resume()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[R]esume last [F]ind" } ) vim.keymap.set( 'n', 'fs', [[lua require('telescope.builtin').spell_suggest()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [S]pelling suggestion" } ) vim.keymap.set( 'n', 'fgc', [[lua require('telescope.builtin').git_commits()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [G]it [C]ommits" } ) vim.keymap.set( "n", 'fga', [[lua require('telescope.builtin').git_bcommits()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [G]it commits for current buffer" } ) vim.keymap.set( 'n', 'fgb', [[lua require('telescope.builtin').git_branches()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [G]it [B]ranches" } ) vim.keymap.set( 'n', 'fe', [[Telescope emoji]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [E]moji" } ) vim.keymap.set( 'n', 'f"', [[lua require('telescope.builtin').registers()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind registers [\"]" } ) vim.keymap.set( 'n', 'fm', [[lua require('telescope.builtin').keymaps()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind key [M]appings" } ) vim.keymap.set( 'n', 'ff', [[lua require('telescope.builtin').builtin()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind telescope [F]inders" } ) vim.keymap.set( 'n', 'fl', [[lua require('telescope.builtin').reloader()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "[F]ind [L]ua module to reload" } ) vim.keymap.set( 'n', '', [[lua require('telescope').extensions.project.project({ display_type = 'full' })]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Find projects" } ) vim.keymap.set( 'n', '`', [[lua require('session-lens').search_session()]], - { noremap = true, silent = true } + { noremap = true, silent = true, desc = "Find sessions" } ) diff --git a/lua/plugins/toggleterm-nvim.lua b/lua/plugins/toggleterm-nvim.lua index 0d6fa3a..bc2f704 100644 --- a/lua/plugins/toggleterm-nvim.lua +++ b/lua/plugins/toggleterm-nvim.lua @@ -5,17 +5,17 @@ require("toggleterm").setup({ -- shell = 'fish', }) -vim.keymap.set('n', [[]], [[ToggleTerm direction=float]]) -vim.keymap.set('n', [[]], [[ToggleTerm direction=horizontal]]) +vim.keymap.set('n', [[]], [[ToggleTerm direction=float]], { desc = "Toggle terminal in floating window" }) +vim.keymap.set('n', [[]], [[ToggleTerm direction=horizontal]], { desc = "Toggle terminal in horizontal bottom window" }) -- tmux muscle-memory for fullscreening nvim window -- replaced with true-zen.nvim -- vim.keymap.set('n', [[z]], [[ToggleTermToggleAll]]) -- vim.keymap.set('t', [[z]], [[tab split]]) -vim.keymap.set('t', '', [[]]) -vim.keymap.set('t', '', [[wincmd h]]) -vim.keymap.set('t', '', [[wincmd k]]) -vim.keymap.set('t', '', [[wincmd h]]) -vim.keymap.set('t', '', [[wincmd l]]) +vim.keymap.set('t', '', [[]], { desc = "Escape terminal mode" }) +vim.keymap.set('t', '', [[wincmd h]], { desc = "Move focus down one window" }) +vim.keymap.set('t', '', [[wincmd k]], { desc = "Move focus up one window" }) +vim.keymap.set('t', '', [[wincmd h]], { desc = "Move focus left one window" }) +vim.keymap.set('t', '', [[wincmd l]], { desc = "Move focus right one window" }) -- vim.keymap.set('n', '', [[ToggleTerm]], { noremap = true, silent = true }) -- vim.keymap.set('t', '', [[ToggleTerm]], { noremap = true, silent = true }) @@ -38,7 +38,7 @@ function _gitui_toggle() gitui:toggle() end -vim.keymap.set('n', 'G', 'lua _gitui_toggle()', { noremap = true, silent = true }) +vim.keymap.set('n', 'G', 'lua _gitui_toggle()', { noremap = true, silent = true, desc = "Toggle gitui floating terminal" }) -- Custom clx commandline hacker news terminal local clx = Terminal:new({ @@ -57,4 +57,4 @@ function _clx_toggle() clx:toggle() end -vim.keymap.set('n', 'H', 'lua _clx_toggle()', { noremap = true, silent = true }) +vim.keymap.set('n', 'H', 'lua _clx_toggle()', { noremap = true, silent = true, desc = "Toggle clx (console HackerNews) floating terminal" }) diff --git a/lua/plugins/trouble-nvim.lua b/lua/plugins/trouble-nvim.lua index b9c3111..6dbbe5e 100644 --- a/lua/plugins/trouble-nvim.lua +++ b/lua/plugins/trouble-nvim.lua @@ -1,18 +1,18 @@ vim.keymap.set('n', 'xx', 'TroubleToggle', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble buffer diagnostics" } ) vim.keymap.set('n', 'xw', 'TroubleToggle workspace_diagnostics', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble workspace diagnostics" } ) vim.keymap.set('n', 'xd', 'TroubleToggle document_diagnostics', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble document diagnostics" } ) vim.keymap.set('n', 'xl', 'TroubleToggle loclist', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble diagnostics in loclist" } ) vim.keymap.set('n', 'xq', 'TroubleToggle quickfix', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble diagnostics in quickfix" } ) vim.keymap.set('n', 'gR', 'TroubleToggle lsp_references', - { silent = true, noremap = true } + { silent = true, noremap = true, desc = "Toggle trouble LSP [R]eferences under cursor" } ) diff --git a/lua/plugins/true-zen-nvim.lua b/lua/plugins/true-zen-nvim.lua index 9fc5888..39814c3 100644 --- a/lua/plugins/true-zen-nvim.lua +++ b/lua/plugins/true-zen-nvim.lua @@ -1,10 +1,10 @@ require('true-zen').setup() -vim.keymap.set('n', 'zn', [[:TZNarrow]], { noremap = true, silent = true }) -vim.keymap.set('v', 'zn', [[:'<,'>TZNarrow]], { noremap = true, silent = true }) -vim.keymap.set('n', 'zf', [[:TZFocus]], { noremap = true, silent = true }) -vim.keymap.set('n', 'zm', [[:TZMinimalist]], { noremap = true, silent = true }) -vim.keymap.set('n', 'za', [[:TZAtaraxis]], { noremap = true, silent = true }) +vim.keymap.set('n', 'zn', [[:TZNarrow]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow current line" }) +vim.keymap.set('v', 'zn', [[:'<,'>TZNarrow]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow selected lines" }) +vim.keymap.set('n', 'zf', [[:TZFocus]], { noremap = true, silent = true, desc = "[Z]oom [N]arrow current buffer in new tab" }) +vim.keymap.set('n', 'zm', [[:TZMinimalist]], { noremap = true, silent = true, desc = "[Z] Toggle minimalist nvim UI mode" }) +vim.keymap.set('n', 'za', [[:TZAtaraxis]], { noremap = true, silent = true, desc = "[Z]oom [A]taraxis current buffer minimalist mode" }) -- tmux muscle-memory for fullscreening nvim window -vim.keymap.set('n', [[z]], [[:TZFocus]]) -vim.keymap.set('t', [[z]], [[:TZFocus]]) +vim.keymap.set('n', [[z]], [[:TZFocus]], { desc = "Toggle [Z]oom current buffer in new tab" }) +vim.keymap.set('t', [[z]], [[:TZFocus]], { desc = "Toggle [Z]oom current terminal buffer in new tab" }) diff --git a/lua/plugins/vim-mundo.lua b/lua/plugins/vim-mundo.lua index 858c1fa..5d35dc6 100644 --- a/lua/plugins/vim-mundo.lua +++ b/lua/plugins/vim-mundo.lua @@ -1 +1 @@ -vim.keymap.set('n', 'u', [[MundoToggle]], { noremap = true, silent = true }) +vim.keymap.set('n', 'u', [[MundoToggle]], { noremap = true, silent = true, desc = "Toggle [U]ndo UI"}) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 469bb80..09b2dfb 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -12,9 +12,9 @@ vim.keymap.set('n', '', 'k') vim.keymap.set('n', '', 'h') vim.keymap.set('n', '', 'l') -vim.keymap.set('n', ',', ':noh', { silent = true }) +vim.keymap.set('n', ',', ':noh', { silent = true, desc = "Clear highlighting" }) -vim.keymap.set('n', 'v', [[:e ~/.config/nvim/init.lua]], { silent = true }) +vim.keymap.set('n', 'v', [[:e ~/.config/nvim/init.lua]], { silent = true, desc = "Open [V]im config" }) -- URL handling (since I disabled netrw) -- source: https://sbulav.github.io/vim/neovim-opening-urls/ diff --git a/lua/user/settings.lua b/lua/user/settings.lua index 206fc5e..f269a8b 100644 --- a/lua/user/settings.lua +++ b/lua/user/settings.lua @@ -78,3 +78,14 @@ vim.g.neovide_cursor_animation_length = 0.06 vim.g.neovide_cursor_trail_size = 0.2 -- default: 0.8 vim.api.nvim_set_hl(0, 'OctoEditable', { bg = '#313131' }) + +-- [[ Highlight on yank ]] +-- See `:help vim.highlight.on_yank()` +local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) +vim.api.nvim_create_autocmd('TextYankPost', { + callback = function() + vim.highlight.on_yank() + end, + group = highlight_group, + pattern = '*', +})