-- 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 = 50, }, indent = { enable = true, chars = { "|" }, style = "#5A639C" }, blank = { enable = false, }, line_num = { enable = true, }, })) 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" } opts.ignored_buftypes = { "nofile" } 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", }, }, }, -- Find and replace { "MagicDuck/grug-far.nvim", cmd = "GrugFar", config = function() require("grug-far").setup { windowCreationCommand = "tabnew", } end, keys = { { "R", function() require("grug-far").grug_far { prefills = { search = vim.fn.expand "" } } end, mode = { "n" }, desc = "Open GrugFar", }, }, }, -- Markdown preview support { "OXY2DEV/markview.nvim", dependencies = { { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "markdown", "markdown_inline" }) end, }, }, ft = { "markdown" }, }, }