-- Plugins that enhance editor experience return { { "numToStr/Comment.nvim", opts = { -- Ignore empty line ignore = "^$", }, keys = { { "", function() require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1) end, mode = { "n", "i" }, desc = "Comment line", }, { "", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", mode = { "v" }, desc = "Comment block", }, }, }, -- Built-in terminal support { "akinsho/toggleterm.nvim", opts = function(_, opts) -- Use powershell for toggleterm on windows -- if vim.fn.has "win32" then opts.shell = "pwsh.exe" end end, }, -- File tagging and navigation -- { -- "cbochs/grapple.nvim", -- dependencies = { -- "nvim-lua/plenary.nvim", -- { -- "AstroNvim/astrocore", -- opts = function(_, opts) -- opts.mappings.n[""] = { desc = require("astroui").get_icon("Grapple", 1, true) .. "Grapple" } -- end, -- }, -- }, -- opts = { -- scope = "git_branch", -- }, -- cmd = { "Grapple" }, -- keys = { -- { "a", "Grapple tag", desc = "Add tag to file" }, -- { "d", "Grapple untag", desc = "Delete tag from file" }, -- { "e", "Grapple toggle_tags", desc = "Select from tags" }, -- { "s", "Grapple toggle_scopes", desc = "Select a project scope" }, -- { "x", "Grapple reset", desc = "Clear tags" }, -- { "", "Grapple cycle forward", desc = "Select next tag" }, -- { "", "Grapple cycle backward", desc = "Select previous tag" }, -- }, -- }, -- Better escape support -- { -- "max397574/better-escape.nvim", -- opts = { -- mapping = { "jj", "kk", "jk" }, -- }, -- }, -- Better indent blankline -- { -- "shellRaining/hlchunk.nvim", -- event = { "BufReadPre", "BufNewFile" }, -- config = function(_, opts) -- require("hlchunk").setup(require("astrocore").extend_tbl(opts, { -- ignore = {}, -- chunk = { -- enable = true, -- notify = false, -- chars = { -- -- horizontal_line = "━", -- -- vertical_line = "┃", -- -- left_top = "┏", -- -- left_bottom = "┗", -- -- right_arrow = "➤", -- }, -- style = "#06D001", -- delay = 25, -- }, -- indent = { -- enable = false, -- use_treesitter = true, -- chars = { -- "│", -- }, -- }, -- blank = { -- enable = false, -- chars = { -- " ", -- }, -- style = { -- { bg = "#434437" }, -- { bg = "#2f4440" }, -- { bg = "#433054" }, -- { bg = "#284251" }, -- }, -- }, -- line_num = { -- enable = false, -- }, -- })) -- end, -- }, -- AI code completion -- { -- "monkoose/neocodeium", -- event = "LspAttach", -- config = function() -- local neocodeium = require "neocodeium" -- neocodeium.setup() -- vim.keymap.set("n", ";", function() require("neocodeium.commands").toggle() end) -- vim.keymap.set("i", "", function() require("neocodeium").accept() end) -- vim.keymap.set("i", "", function() require("neocodeium").accept_word() end) -- vim.keymap.set("i", "", function() require("neocodeium").accept_line() end) -- vim.keymap.set("i", "", function() require("neocodeium").cycle_or_complete() end) -- vim.keymap.set("i", "", function() require("neocodeium").cycle_or_complete(-1) end) -- vim.keymap.set("i", "", function() require("neocodeium").clear() end) -- end, -- }, -- Multi-cursors support { "brenton-leighton/multiple-cursors.nvim", version = "*", opts = {}, keys = { { "", "MultipleCursorsAddDown", mode = { "n", "i", "x" } }, { "", "MultipleCursorsAddUp", mode = { "n", "i", "x" } }, { "", "MultipleCursorsMouseAddDelete", mode = { "n", "i" } }, { "a", "MultipleCursorsAddMatches", mode = { "n", "x" } }, { "", "MultipleCursorsAddJumpNextMatch", mode = { "n", "x" } }, }, }, -- Better code folding { "kevinhwang91/nvim-ufo", opts = { -- Add virtual text to show how many lines are folded 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, }, }, -- Better split navigation and resize { "mrjones2014/smart-splits.nvim", event = "VeryLazy", -- load on very lazy for mux detection opts = function(_, opts) opts.ignored_filetypes = { "nofile", "quickfix", "qf", "prompt", "NvimTree" } opts.ignored_buftypes = { "nofile" } opts.log_level = "error" end, keys = { { "", function() require("smart-splits").move_cursor_left() end, mode = { "n" }, desc = "Move to left split", }, { "", function() require("smart-splits").move_cursor_right() end, mode = { "n", "t" }, desc = "Move to right split", }, { "", function() require("smart-splits").move_cursor_up() end, mode = { "n" }, desc = "Move to above split", }, { "", function() require("smart-splits").move_cursor_down() end, mode = { "n" }, desc = "Move to below split", }, -- { -- "", -- function() require("smart-splits").resize_left() end, -- mode = { "n" }, -- desc = "Resize split left", -- }, -- { -- "", -- function() require("smart-splits").resize_right() end, -- mode = { "n" }, -- desc = "Resize split right", -- }, -- { -- "", -- function() require("smart-splits").resize_up() end, -- mode = { "n" }, -- desc = "Resize split up", -- }, -- { -- "", -- function() require("smart-splits").resize_down() end, -- mode = { "n" }, -- desc = "Resize split down", -- }, { "", function() require("smart-splits").resize_left() end, mode = { "n" }, desc = "Resize split left", }, { "", function() require("smart-splits").resize_right() end, mode = { "n" }, desc = "Resize split right", }, -- { -- "", -- function() require("smart-splits").resize_up() end, -- mode = { "n" }, -- desc = "Resize split up", -- }, -- { -- "", -- function() require("smart-splits").resize_down() end, -- mode = { "n" }, -- desc = "Resize split down", -- }, }, }, }