From 06e05e042d077a6666274b916edffcd9433e3a38 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 14 Oct 2025 22:20:57 +0545 Subject: [PATCH] feat: enhance editor with treesitter, autotag, search/replace, folds, git, and UI plugins --- lazy-lock.json | 3 +- lua/core/keys.lua | 29 ++++ lua/plugins/coding.lua | 57 ++++++++ lua/plugins/editor.lua | 42 +----- lua/plugins/git.lua | 6 +- lua/plugins/languages.lua | 145 ------------------- lua/plugins/lsp.lua | 41 ++++++ lua/plugins/treesitter.lua | 45 ++++++ lua/plugins/ui.lua | 116 +++++++++++++++ lua/plugins/util.lua | 181 +++++++++++++++++++++++ lua/plugins/utility.lua | 288 ------------------------------------- lua/plugins/whichkey.lua | 6 +- 12 files changed, 476 insertions(+), 483 deletions(-) create mode 100644 lua/plugins/coding.lua delete mode 100644 lua/plugins/languages.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 lua/plugins/ui.lua create mode 100755 lua/plugins/util.lua delete mode 100755 lua/plugins/utility.lua diff --git a/lazy-lock.json b/lazy-lock.json index ed97aea..86de907 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,7 +9,6 @@ "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, "hardtime.nvim": { "branch": "main", "commit": "b4e431934af1fe224a3a801f632c008278cb7628" }, - "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, "lspsaga.nvim": { "branch": "main", "commit": "8efe00d6aed9db6449969f889170f1a7e43101a1" }, @@ -32,7 +31,6 @@ "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, "nvim-ufo": { "branch": "main", "commit": "72d54c31079d38d8dfc5456131b1d0fb5c0264b0" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "snacks.nvim": { "branch": "main", "commit": "38fbb948bcf2add5005bbc06402768dcd27a275e" }, "tiny-code-action.nvim": { "branch": "main", "commit": "9b7359aca74875880a4f83034ded67325e47ef9b" }, @@ -41,6 +39,7 @@ "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "treesj": { "branch": "main", "commit": "4770492244ccecdc9b01e0e81fa8f2f6b4a23841" }, "uv.nvim": { "branch": "main", "commit": "be4a7d47a976249282bb2f71fc773ac2f5325973" }, + "vim-suda": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }, "vim-wakatime": { "branch": "master", "commit": "d7973b157a632d1edeff01818f18d67e584eeaff" }, "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }, diff --git a/lua/core/keys.lua b/lua/core/keys.lua index 33ef5cd..61d4555 100644 --- a/lua/core/keys.lua +++ b/lua/core/keys.lua @@ -109,3 +109,32 @@ map({ 'n', 'v' }, 'L', '$', { desc = 'Move to the end of the line' }) -- Search inside visually highlighted text. map('x', 'g/', '/\\%V', { silent = false, desc = 'Search inside visual selection' }) + +-- Search & replace in current file/line +map('v', 'rw', '"9y:%s@9@9@g', { desc = 'Search & replace selection', silent = false }) +map('n', 'rw', 'viw"9y:%s@9@9@g', { desc = 'Search & replace word', silent = false }) +map( + 'v', + 'rl', + '"9y:s@9@9@g', + { desc = 'Search & replace in current line', silent = false } +) +map( + 'n', + 'rl', + 'viw"9y:s@9@9@g', + { desc = 'Search & replace word in current line', silent = false } +) + +-- Folds +map('n', '<', function() + if not vim.opt.foldmethod then + vim.opt.foldmethod = 'indent' + end + vim.cmd('normal! zM') +end, { desc = 'Fold all' }) + +map('n', '>', function() + vim.opt.foldenable = false + vim.cmd('normal! zR') +end, { desc = 'Open all folds' }) diff --git a/lua/plugins/coding.lua b/lua/plugins/coding.lua new file mode 100644 index 0000000..82f9bfe --- /dev/null +++ b/lua/plugins/coding.lua @@ -0,0 +1,57 @@ +return { + -- auto pairs + { + 'windwp/nvim-autopairs', + enabled = false, + event = 'InsertEnter', + config = function() + local npairs = require('nvim-autopairs') + + npairs.setup({ + check_ts = true, + enable_check_bracket_line = true, + fast_wrap = {}, + map_cr = true, + map_bs = true, + }) + end, + }, + + -- auto tag + { + 'windwp/nvim-ts-autotag', + ft = { + 'html', + 'xml', + 'javascript', + 'typescript', + 'javascriptreact', + 'typescriptreact', + 'jsx', + 'tsx', + 'vue', + 'svelte', + 'markdown', + 'htmldjango', + }, + event = 'InsertEnter', + lazy = true, + config = function() + require('nvim-ts-autotag').setup({ + enable_close = true, + enable_rename = true, + enable_close_on_slash = true, + }) + end, + }, + + -- split join code + { + 'Wansmer/treesj', + keys = { 'm', 'j', 's' }, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, -- if you install parsers with `nvim-treesitter` + config = function() + require('treesj').setup() + end, + }, +} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 86c6d03..ff5dfc1 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -24,6 +24,7 @@ return { end, }, + -- comment { 'numToStr/Comment.nvim', version = false, @@ -88,47 +89,6 @@ return { opts = {}, }, - -- inline diagnostic - { - 'rachartier/tiny-inline-diagnostic.nvim', - event = 'VeryLazy', - priority = 1000, - config = function() - require('tiny-inline-diagnostic').setup() - vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text - end, - }, - - -- code action - { - 'rachartier/tiny-code-action.nvim', - dependencies = { - { - 'folke/snacks.nvim', - opts = { - terminal = {}, - }, - }, - }, - event = 'LspAttach', - config = function() - local codeaction = require('tiny-code-action') - - codeaction.setup({ - picker = { - 'buffer', - opts = { - auto_preview = true, - hotkeys = true, - hotkeys_mode = 'sequential', - }, - }, - }) - - vim.keymap.set('n', '.', codeaction.code_action) - end, - }, - -- visual multi { 'mg979/vim-visual-multi', diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 4946b99..d9dff81 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -23,8 +23,8 @@ return { }, signs_staged_enable = true, signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` watch_gitdir = { follow_files = true, @@ -43,7 +43,7 @@ return { current_line_blame_formatter = ', - ', sign_priority = 6, update_debounce = 100, - status_formatter = nil, -- Use default + status_formatter = nil, -- Use default max_file_length = 40000, -- Disable if file is longer than this (in lines) preview_config = { -- Options passed to nvim_open_win diff --git a/lua/plugins/languages.lua b/lua/plugins/languages.lua deleted file mode 100644 index a46144c..0000000 --- a/lua/plugins/languages.lua +++ /dev/null @@ -1,145 +0,0 @@ -return { - -- treesitter - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - event = { 'BufReadPost', 'BufNewFile' }, - config = function() - require('nvim-treesitter').setup({ - ensure_installed = { - 'c', - 'markdown', - 'python', - 'java', - 'cpp', - 'bash', - 'lua', - 'make', - 'latex', - 'json', - 'jsonc', - 'sql', - 'yaml', - 'toml', - 'javascript', - 'typescript', - 'gitignore', - 'go', - 'rust', - 'html', - 'css', - 'scss', - 'markdown_inline', - }, - auto_install = true, - highlight = { - enable = true, - additional_vim_regex_highlighting = true, - }, - indent = { - enable = true, - }, - }) - end, - }, - - -- rendering for html, latex, md - { - 'OXY2DEV/markview.nvim', - lazy = false, - -- to load before treesitter - priority = 45, - config = function() - require('markview').setup({ - markdown = { - code_blocks = { sign = false }, - }, - }) - end, - }, - - -- markdown preview - { - 'iamcco/markdown-preview.nvim', - build = 'cd app && yarn install', - init = function() - vim.g.mkdp_filetypes = { 'markdown' } - end, - ft = 'markdown', - cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' }, - }, - - { - 'danymat/neogen', - dependencies = { 'nvim-treesitter/nvim-treesitter' }, - opts = { - snippet_engine = 'luasnip', - languages = { - python = { - template = { - annotation_convention = 'google_docstrings', - }, - }, - }, - }, - }, - - -- auto pairs - { - 'windwp/nvim-autopairs', - enabled = false, - event = 'InsertEnter', - config = function() - local npairs = require('nvim-autopairs') - - npairs.setup({ - check_ts = true, - enable_check_bracket_line = true, - fast_wrap = {}, - map_cr = true, - map_bs = true, - }) - end, - }, - - { - 'windwp/nvim-ts-autotag', - ft = { - 'html', - 'xml', - 'javascript', - 'typescript', - 'javascriptreact', - 'typescriptreact', - 'jsx', - 'tsx', - 'vue', - 'svelte', - 'markdown', - }, - event = 'InsertEnter', - lazy = true, - config = function() - require('nvim-ts-autotag').setup({ - enable_close = true, - enable_rename = true, - enable_close_on_slash = true, - }) - end, - }, - - { - 'Wansmer/treesj', - keys = { 'm', 'j', 's' }, - dependencies = { 'nvim-treesitter/nvim-treesitter' }, -- if you install parsers with `nvim-treesitter` - config = function() - require('treesj').setup() - end, - }, - - { - 'davidmh/mdx.nvim', - config = true, - dependencies = { 'nvim-treesitter/nvim-treesitter' }, - }, -} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index ddb7c9b..388c863 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -66,4 +66,45 @@ return { }) end, }, + + -- inline diagnostic + { + 'rachartier/tiny-inline-diagnostic.nvim', + event = 'VeryLazy', + priority = 1000, + config = function() + require('tiny-inline-diagnostic').setup() + vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text + end, + }, + + -- code action + { + 'rachartier/tiny-code-action.nvim', + dependencies = { + { + 'folke/snacks.nvim', + opts = { + terminal = {}, + }, + }, + }, + event = 'LspAttach', + config = function() + local codeaction = require('tiny-code-action') + + codeaction.setup({ + picker = { + 'buffer', + opts = { + auto_preview = true, + hotkeys = true, + hotkeys_mode = 'sequential', + }, + }, + }) + + vim.keymap.set('n', '.', codeaction.code_action) + end, + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..8152a1b --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,45 @@ +return { + -- treesitter + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + event = { 'BufReadPost', 'BufNewFile' }, + config = function() + require('nvim-treesitter').setup({ + ensure_installed = { + 'c', + 'markdown', + 'python', + 'java', + 'cpp', + 'bash', + 'lua', + 'make', + 'latex', + 'json', + 'jsonc', + 'sql', + 'yaml', + 'toml', + 'javascript', + 'typescript', + 'gitignore', + 'go', + 'rust', + 'html', + 'css', + 'scss', + 'markdown_inline', + }, + auto_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = true, + }, + indent = { + enable = true, + }, + }) + end, + }, +} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua new file mode 100644 index 0000000..0c86cbf --- /dev/null +++ b/lua/plugins/ui.lua @@ -0,0 +1,116 @@ +return { + + -- rendering for html, latex, md + { + 'OXY2DEV/markview.nvim', + lazy = false, + -- to load before treesitter + priority = 45, + config = function() + require('markview').setup({ + markdown = { + code_blocks = { sign = false }, + }, + }) + end, + }, + + -- markdown preview + { + 'iamcco/markdown-preview.nvim', + build = 'cd app && yarn install', + init = function() + vim.g.mkdp_filetypes = { 'markdown' } + end, + ft = 'markdown', + cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' }, + }, + + -- fold + { + 'kevinhwang91/nvim-ufo', + event = { 'BufReadPost', 'BufNewFile' }, + dependencies = { 'kevinhwang91/promise-async', event = 'BufReadPost' }, + opts = { + provider_selector = function() + return { 'lsp', 'indent' } + end, + fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate) + local newVirtText = {} + local suffix = (' … %d '):format(endLnum - lnum) + local sufWidth = vim.fn.strdisplaywidth(suffix) + local targetWidth = width - sufWidth + local curWidth = 0 + for _, chunk in ipairs(virtText) do + local chunkText = chunk[1] + local chunkWidth = vim.fn.strdisplaywidth(chunkText) + if targetWidth > curWidth + chunkWidth then + table.insert(newVirtText, chunk) + else + chunkText = truncate(chunkText, targetWidth - curWidth) + local hlGroup = chunk[2] + table.insert(newVirtText, { chunkText, hlGroup }) + chunkWidth = vim.fn.strdisplaywidth(chunkText) + -- str width returned from truncate() may less than 2nd argument, need padding + if curWidth + chunkWidth < targetWidth then + suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) + end + break + end + curWidth = curWidth + chunkWidth + end + table.insert(newVirtText, { suffix, 'MoreMsg' }) + return newVirtText + end, + open_fold_hl_timeout = 0, + }, + keys = { + { 'fd', 'zd', desc = 'Delete fold under cursor' }, + { 'fo', 'zo', desc = 'Open fold under cursor' }, + { 'fO', 'zO', desc = 'Open all folds under cursor' }, + { 'fc', 'zC', desc = 'Close all folds under cursor' }, + { 'fa', 'za', desc = 'Toggle fold under cursor' }, + { 'fA', 'zA', desc = 'Toggle all folds under cursor' }, + { 'fv', 'zv', desc = 'Show cursor line' }, + { + 'fM', + function() + require('ufo').closeAllFolds() + end, + desc = 'Close all folds', + }, + { + 'fR', + function() + require('ufo').openAllFolds() + end, + desc = 'Open all folds', + }, + { + 'fm', + function() + require('ufo').closeFoldsWith() + end, + desc = 'Fold more', + }, + { + 'fr', + function() + require('ufo').openFoldsExceptKinds() + end, + desc = 'Fold less', + }, + { 'fx', 'zx', desc = 'Update folds' }, + { 'fz', 'zz', desc = 'Center this line' }, + { 'ft', 'zt', desc = 'Top this line' }, + { 'fb', 'zb', desc = 'Bottom this line' }, + { 'fg', 'zg', desc = 'Add word to spell list' }, + { 'fw', 'zw', desc = 'Mark word as bad/misspelling' }, + { 'fe', 'ze', desc = 'Right this line' }, + { 'fE', 'zE', desc = 'Delete all folds in current buffer' }, + { 'fs', 'zs', desc = 'Left this line' }, + { 'fH', 'zH', desc = 'Half screen to the left' }, + { 'fL', 'zL', desc = 'Half screen to the right' }, + }, + }, +} diff --git a/lua/plugins/util.lua b/lua/plugins/util.lua new file mode 100755 index 0000000..54e2fc4 --- /dev/null +++ b/lua/plugins/util.lua @@ -0,0 +1,181 @@ +return { + + { + 'danymat/neogen', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + opts = { + snippet_engine = 'luasnip', + languages = { + python = { + template = { + annotation_convention = 'google_docstrings', + }, + }, + }, + }, + }, + + { + 'davidmh/mdx.nvim', + config = true, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + }, + + -- better escape + { + 'max397574/better-escape.nvim', + config = function() + require('better_escape').setup({ + mappings = { + -- i for insert, other modes are the first letter too + i = { + -- map kj to exit insert mode + k = { + j = '', + }, + -- map jk and jj to exit insert mode + j = { + k = '', + j = '', + }, + -- disable jj + j = { + j = false, + }, + }, + }, + }) + end, + }, + + -- Navigator + { + 'numToStr/Navigator.nvim', + event = 'VeryLazy', + config = function() + require('Navigator').setup({ + auto_save = 'current', + disable_on_zoom = false, + mux = 'auto', + }) + end, + }, + + -- float terminal + { + 'akinsho/toggleterm.nvim', + cmd = { 'ToggleTerm' }, + version = '*', + config = function() + require('toggleterm').setup({ + size = 10, + open_mapping = [[]], + hide_numbers = true, + shade_filetypes = {}, + shade_terminals = true, + shading_factor = '2', + start_in_insert = true, + insert_mappings = true, + terminal_mappings = true, + persist_size = true, + direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float' + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + border = 'curved', -- 'single', 'double', 'shadow', etc. + winblend = 0, -- Set to 0 for full transparency + highlights = { + border = 'Normal', + background = 'Normal', + }, + }, + }) + end, + }, + + -- smooth scrolling + { + 'karb94/neoscroll.nvim', + opts = {}, + }, + + -- discord presence + -- { + -- "vyfor/cord.nvim", + -- event = "VeryLazy", + -- }, + + -- uv + { + 'benomahony/uv.nvim', + ft = 'python', + event = 'BufReadPre', + opts = { + picker_integration = true, + keymaps = { + prefix = 'u', -- Main prefix for uv commands + commands = true, -- Show uv commands menu (x) + run_file = true, -- Run current file (xr) + run_selection = true, -- Run selected code (xs) + run_function = true, -- Run function (xf) + venv = true, -- Environment management (xe) + init = true, -- Initialize uv project (xi) + add = true, -- Add a package (xa) + remove = true, -- Remove a package (xd) + sync = true, -- Sync packages (xc) + sync_all = true, -- Sync all packages, extras and groups (xC) + }, + }, + }, + + -- wakatime + { 'wakatime/vim-wakatime', event = 'VimEnter', lazy = false }, + + -- workflow + { + 'm4xshen/hardtime.nvim', + lazy = false, + opts = {}, + }, + + -- file operations + { + 'chrisgrieser/nvim-genghis', + keys = { + { + 'fn', + function() + require('genghis').createNewFile() + end, + desc = 'New File', + }, + { + 'fd', + function() + require('genghis').duplicateFile() + end, + desc = 'Duplicate File', + }, + { + 'fr', + function() + require('genghis').renameFile() + end, + desc = 'Rename File', + }, + { + 'fx', + function() + require('genghis').chmodx() + end, + desc = 'Make Executable', + }, + }, + }, + + -- Working with file permissions + { + 'lambdalisue/vim-suda', + cmd = { 'SudaRead', 'SudaWrite' }, + }, +} diff --git a/lua/plugins/utility.lua b/lua/plugins/utility.lua deleted file mode 100755 index 9498f51..0000000 --- a/lua/plugins/utility.lua +++ /dev/null @@ -1,288 +0,0 @@ -return { - --harpoon - { - 'ThePrimeagen/harpoon', - branch = 'harpoon2', - dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - local harpoon = require('harpoon') - harpoon:setup() - - vim.keymap.set('n', 'ha', function() - harpoon:list():add() - end, { desc = 'Harpoon add file' }) - vim.keymap.set('n', 'hl', function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end, { desc = 'Harpoon quick menu' }) - - for i = 1, 9 do - vim.keymap.set('n', '', function() - harpoon:list():select(i) - end, { desc = 'Harpoon to file ' .. i }) - end - end, - }, - - -- better escape - { - 'max397574/better-escape.nvim', - config = function() - require('better_escape').setup({ - mappings = { - -- i for insert, other modes are the first letter too - i = { - -- map kj to exit insert mode - k = { - j = '', - }, - -- map jk and jj to exit insert mode - j = { - k = '', - j = '', - }, - -- disable jj - j = { - j = false, - }, - }, - }, - }) - end, - }, - - -- Navigator - { - 'numToStr/Navigator.nvim', - event = 'VeryLazy', - config = function() - require('Navigator').setup({ - auto_save = 'current', - disable_on_zoom = false, - mux = 'auto', - }) - end, - }, - - -- float terminal - { - 'akinsho/toggleterm.nvim', - cmd = { 'ToggleTerm' }, - version = '*', - config = function() - require('toggleterm').setup({ - size = 10, - open_mapping = [[]], - hide_numbers = true, - shade_filetypes = {}, - shade_terminals = true, - shading_factor = '2', - start_in_insert = true, - insert_mappings = true, - terminal_mappings = true, - persist_size = true, - direction = 'float', -- 'vertical' | 'horizontal' | 'tab' | 'float' - close_on_exit = true, - shell = vim.o.shell, - float_opts = { - border = 'curved', -- 'single', 'double', 'shadow', etc. - winblend = 0, -- Set to 0 for full transparency - highlights = { - border = 'Normal', - background = 'Normal', - }, - }, - }) - end, - }, - - -- smooth scrolling - { - 'karb94/neoscroll.nvim', - opts = {}, - }, - - -- discord presence - -- { - -- "vyfor/cord.nvim", - -- event = "VeryLazy", - -- }, - - -- uv - { - 'benomahony/uv.nvim', - ft = 'python', - event = 'BufReadPre', - opts = { - picker_integration = true, - keymaps = { - prefix = 'u', -- Main prefix for uv commands - commands = true, -- Show uv commands menu (x) - run_file = true, -- Run current file (xr) - run_selection = true, -- Run selected code (xs) - run_function = true, -- Run function (xf) - venv = true, -- Environment management (xe) - init = true, -- Initialize uv project (xi) - add = true, -- Add a package (xa) - remove = true, -- Remove a package (xd) - sync = true, -- Sync packages (xc) - sync_all = true, -- Sync all packages, extras and groups (xC) - }, - }, - }, - - { 'wakatime/vim-wakatime', event = 'VimEnter', lazy = false }, - - { - 'm4xshen/hardtime.nvim', - lazy = false, - opts = {}, - }, - - -- file operations - { - 'chrisgrieser/nvim-genghis', - keys = { - { - 'fn', - function() - require('genghis').createNewFile() - end, - desc = 'New File', - }, - { - 'fd', - function() - require('genghis').duplicateFile() - end, - desc = 'Duplicate File', - }, - { - 'fr', - function() - require('genghis').renameFile() - end, - desc = 'Rename File', - }, - { - 'fx', - function() - require('genghis').chmodx() - end, - desc = 'Make Executable', - }, - }, - }, - - -- fold - { - 'kevinhwang91/nvim-ufo', - event = { 'BufReadPost', 'BufNewFile' }, - dependencies = { 'kevinhwang91/promise-async', event = 'BufReadPost' }, - opts = { - provider_selector = function() - return { 'lsp', 'indent' } - end, - fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate) - local newVirtText = {} - local suffix = (' … %d '):format(endLnum - lnum) - local sufWidth = vim.fn.strdisplaywidth(suffix) - local targetWidth = width - sufWidth - local curWidth = 0 - for _, chunk in ipairs(virtText) do - local chunkText = chunk[1] - local chunkWidth = vim.fn.strdisplaywidth(chunkText) - if targetWidth > curWidth + chunkWidth then - table.insert(newVirtText, chunk) - else - chunkText = truncate(chunkText, targetWidth - curWidth) - local hlGroup = chunk[2] - table.insert(newVirtText, { chunkText, hlGroup }) - chunkWidth = vim.fn.strdisplaywidth(chunkText) - -- str width returned from truncate() may less than 2nd argument, need padding - if curWidth + chunkWidth < targetWidth then - suffix = suffix .. (' '):rep(targetWidth - curWidth - chunkWidth) - end - break - end - curWidth = curWidth + chunkWidth - end - table.insert(newVirtText, { suffix, 'MoreMsg' }) - return newVirtText - end, - open_fold_hl_timeout = 0, - }, - keys = { - { 'fd', 'zd', desc = 'Delete fold under cursor' }, - { 'fo', 'zo', desc = 'Open fold under cursor' }, - { 'fO', 'zO', desc = 'Open all folds under cursor' }, - { 'fc', 'zC', desc = 'Close all folds under cursor' }, - { 'fa', 'za', desc = 'Toggle fold under cursor' }, - { 'fA', 'zA', desc = 'Toggle all folds under cursor' }, - { 'fv', 'zv', desc = 'Show cursor line' }, - { - 'fM', - function() - require('ufo').closeAllFolds() - end, - desc = 'Close all folds', - }, - { - 'fR', - function() - require('ufo').openAllFolds() - end, - desc = 'Open all folds', - }, - { - 'fm', - function() - require('ufo').closeFoldsWith() - end, - desc = 'Fold more', - }, - { - 'fr', - function() - require('ufo').openFoldsExceptKinds() - end, - desc = 'Fold less', - }, - { 'fx', 'zx', desc = 'Update folds' }, - { 'fz', 'zz', desc = 'Center this line' }, - { 'ft', 'zt', desc = 'Top this line' }, - { 'fb', 'zb', desc = 'Bottom this line' }, - { 'fg', 'zg', desc = 'Add word to spell list' }, - { 'fw', 'zw', desc = 'Mark word as bad/misspelling' }, - { 'fe', 'ze', desc = 'Right this line' }, - { 'fE', 'zE', desc = 'Delete all folds in current buffer' }, - { 'fs', 'zs', desc = 'Left this line' }, - { 'fH', 'zH', desc = 'Half screen to the left' }, - { 'fL', 'zL', desc = 'Half screen to the right' }, - }, - }, - - -- Dimming the highlights of unused functions, variables, parameters, and more. - { - 'zbirenbaum/neodim', - enabled = false, - event = 'LspAttach', - config = function() - require('neodim').setup({ - alpha = 0.5, - blend_color = nil, - hide = { - underline = true, - virtual_text = true, - signs = true, - }, - regex = { - '[uU]nused', - '[nN]ever [rR]ead', - '[nN]ot [rR]ead', - }, - priority = 128, - disable = {}, - }) - end, - }, -} diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index 4d9dbf2..c5188c7 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -34,7 +34,7 @@ return { show_help = false, show_keys = true, triggers = { - { '', mode = 'nvisoct' }, + { '', mode = 'nvisoct' }, { '', mode = { 'n', 'v' } }, }, }) @@ -114,8 +114,6 @@ return { { 'gw', ':lua require("snacks").gitbrowse()', desc = 'Git Browse' }, { 'gp', ':lua Snacks.picker.git_branches()', desc = 'Pick and Switch Git Branches' }, - { 'h', group = 'Harpoon' }, - { 'gt', group = 'Toggle' }, { 'gtb', ':Gitsigns toggle_current_line_blame', desc = 'Blame' }, { 'gtd', ':Gitsigns toggle_deleted', desc = 'Deleted' }, @@ -181,10 +179,10 @@ return { { 'r', group = ' Refactor' }, { 'rd', '', desc = 'Go To Definition' }, -- treesitter navigation + { 'rD', '', desc = 'List Definition' }, { 'rh', '', desc = 'List Definition Head' }, { 'rj', '', desc = 'Next Usage' }, { 'rk', '', desc = 'Previous Usage' }, - { 'rl', '', desc = 'List Definition' }, { 'rn', '', desc = 'Swap Next' }, { 'rp', '', desc = 'Swap Previous' }, { 'rr', '', desc = 'Smart Rename' },