-local Util = require("lazyvim.util")
-
----@type LazyPluginSpec
+---@type LazySpec
return {
- {
- "nvim-telescope/telescope.nvim",
+ { "stevearc/oil.nvim",
+ opts = {
+ keymaps = {
+ ["g?"] = "actions.show_help",
+ ["<CR>"] = "actions.select",
+ ["<C-s>"] = "actions.select_vsplit",
+ ["<C-h>"] = false, -- used to be actions.select_split
+ ["<C-t>"] = "actions.select_tab",
+ ["<C-p>"] = "actions.preview",
+ ["<C-c>"] = "actions.close",
+ ["<C-l>"] = false, -- used to be actions.refresh
+ ["-"] = "actions.parent",
+ ["_"] = "actions.open_cwd",
+ ["`"] = "actions.cd",
+ ["~"] = "actions.tcd",
+ ["gs"] = "actions.change_sort",
+ ["gx"] = "actions.open_external",
+ ["g."] = "actions.toggle_hidden",
+ ["g\\"] = "actions.toggle_trash",
+ },
+ },
+ dependencies = {"nvim-tree/nvim-web-devicons"},
+ },
+ { "folke/trouble.nvim",
+ cmd = { "Trouble" },
+ opts = {
+ modes = {
+ lsp = {
+ win = { position = "right" },
+ },
+ },
+ },
keys = {
- { "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
- -- from lazyvim
- { "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
- { "<leader>/", Util.telescope("live_grep"), desc = "Grep (root dir)" },
- { "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
- { "<leader><space>", Util.telescope("files"), desc = "Find Files (root dir)" },
- { "<leader><space>", false },
- -- find
- { "<leader>fb", "<cmd>Telescope buffers sort_lastused=true<CR>", desc = "Buffers" },
- -- { "<leader>ff", Util.telescope("files"), desc = "Find Files (root dir)" },
- { "<leader>ff", false }, -- fswitch
- { "<leader>fF", Util.telescope("files", { cwd = false }), desc = "Find Files (cwd)" },
- { "<leader>fr", "<cmd>Telescope oldfiles<cr>", desc = "Recent" },
- { "<leader>fR", Util.telescope("oldfiles", { cwd = vim.loop.cwd() }), desc = "Recent (cwd)" },
- -- git
- -- { "<leader>gc", "<cmd>Telescope git_commits<CR>", desc = "commits" },
- { "<leader>gc", false },
- -- { "<leader>gs", "<cmd>Telescope git_status<CR>", desc = "status" },
- { "<leader>gs", false },
- -- search
- { "<leader>sa", "<cmd>Telescope autocommands<cr>", desc = "Auto Commands" },
- { "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Buffer" },
- { "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Command History" },
- { "<leader>sC", "<cmd>Telescope commands<cr>", desc = "Commands" },
- { "<leader>sd", "<cmd>Telescope diagnostics bufnr=0<cr>", desc = "Document diagnostics" },
- { "<leader>sD", "<cmd>Telescope diagnostics<cr>", desc = "Workspace diagnostics" },
- { "<leader>sg", Util.telescope("live_grep"), desc = "Grep (root dir)" },
- { "<leader>sG", Util.telescope("live_grep", { cwd = false }), desc = "Grep (cwd)" },
- { "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Help Pages" },
- { "<leader>sH", "<cmd>Telescope highlights<cr>", desc = "Search Highlight Groups" },
- { "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
- { "<leader>sM", "<cmd>Telescope man_pages<cr>", desc = "Man Pages" },
- { "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Jump to Mark" },
- { "<leader>so", "<cmd>Telescope vim_options<cr>", desc = "Options" },
- { "<leader>sR", "<cmd>Telescope resume<cr>", desc = "Resume" },
- { "<leader>sw", Util.telescope("grep_string"), desc = "Word (root dir)" },
- { "<leader>sW", Util.telescope("grep_string", { cwd = false }), desc = "Word (cwd)" },
- { "<leader>uC", Util.telescope("colorscheme", { enable_preview = true }), desc = "Colorscheme with preview" },
- -- {
- -- "<leader>ss",
- -- Util.telescope("lsp_document_symbols", {
- -- symbols = {
- -- "Class",
- -- "Function",
- -- "Method",
- -- "Constructor",
- -- "Interface",
- -- "Module",
- -- "Struct",
- -- "Trait",
- -- "Field",
- -- "Property",
- -- },
- -- }),
- -- desc = "Goto Symbol",
- -- },
- { "<leader>ss", false }, -- use for snippets below
+ { "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics (Trouble)" },
+ { "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics (Trouble)" },
+ { "<leader>cs", "<cmd>Trouble symbols toggle<cr>", desc = "Symbols (Trouble)" },
+ { "<leader>cS", "<cmd>Trouble lsp toggle<cr>", desc = "LSP references/definitions/... (Trouble)" },
+ { "<leader>xL", "<cmd>Trouble loclist toggle<cr>", desc = "Location List (Trouble)" },
+ { "<leader>xQ", "<cmd>Trouble qflist toggle<cr>", desc = "Quickfix List (Trouble)" },
{
- "<leader>sS",
- Util.telescope("lsp_dynamic_workspace_symbols", {
- symbols = {
- "Class",
- "Function",
- "Method",
- "Constructor",
- "Interface",
- "Module",
- "Struct",
- "Trait",
- "Field",
- "Property",
- },
- }),
- desc = "Goto Symbol (Workspace)",
+ "[q",
+ function()
+ if require("trouble").is_open() then
+ require("trouble").prev({ skip_groups = true, jump = true })
+ else
+ local ok, err = pcall(vim.cmd.cprev)
+ if not ok then
+ vim.notify(err, vim.log.levels.ERROR)
+ end
+ end
+ end,
+ desc = "Previous Trouble/Quickfix Item",
+ },
+ {
+ "]q",
+ function()
+ if require("trouble").is_open() then
+ require("trouble").next({ skip_groups = true, jump = true })
+ else
+ local ok, err = pcall(vim.cmd.cnext)
+ if not ok then
+ vim.notify(err, vim.log.levels.ERROR)
+ end
+ end
+ end,
+ desc = "Next Trouble/Quickfix Item",
},
},
},
- {
- "benfowler/telescope-luasnip.nvim",
- dependencies = {
- "telescope.nvim",
+ { "folke/todo-comments.nvim",
+ -- Finds and lists all of the TODO, HACK, BUG, etc comment
+ -- in your project and loads them into a browsable list.
+ cmd = { "TodoTrouble", "TodoTelescope" },
+ event = "LazyFile",
+ -- stylua: ignore
+ keys = {
+ { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" },
+ { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" },
+ { "<leader>xt", "<cmd>Trouble todo toggle<cr>", desc = "Todo (Trouble)" },
+ { "<leader>xT", "<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>", desc = "Todo/Fix/Fixme (Trouble)" },
+ { "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" },
+ { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
+ },
+ opts = {}
+ },
+ { "folke/flash.nvim",
+ -- Flash enhances the built-in search functionality by showing labels
+ -- at the end of each match, letting you quickly jump to a specific
+ -- location.
+ event = "VeryLazy",
+ vscode = true,
+ ---@type Flash.Config
+ opts = {},
+ -- stylua: ignore
+ keys = {
+ { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
+ { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
+ { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
+ { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
+ { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
+ },
+ },
+ { "lewis6991/gitsigns.nvim",
+ -- git signs highlights text that has changed since the list
+ -- git commit, and also lets you interactively stage & unstage
+ -- hunks in a commit.
+ event = "LazyFile",
+ opts = {
+ signs = {
+ add = { text = "▎" },
+ change = { text = "▎" },
+ delete = { text = "" },
+ topdelete = { text = "" },
+ changedelete = { text = "▎" },
+ untracked = { text = "▎" },
+ },
+ signs_staged = {
+ add = { text = "▎" },
+ change = { text = "▎" },
+ delete = { text = "" },
+ topdelete = { text = "" },
+ changedelete = { text = "▎" },
+ },
+ on_attach = function(buffer)
+ local gs = package.loaded.gitsigns
+
+ local function map(mode, l, r, desc)
+ vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
+ end
+
+ -- stylua: ignore start
+ map("n", "]h", function()
+ if vim.wo.diff then
+ vim.cmd.normal({ "]c", bang = true })
+ else
+ gs.nav_hunk("next")
+ end
+ end, "Next Hunk")
+ map("n", "[h", function()
+ if vim.wo.diff then
+ vim.cmd.normal({ "[c", bang = true })
+ else
+ gs.nav_hunk("prev")
+ end
+ end, "Prev Hunk")
+ map("n", "]H", function() gs.nav_hunk("last") end, "Last Hunk")
+ map("n", "[H", function() gs.nav_hunk("first") end, "First Hunk")
+ map({ "n", "v" }, "<leader>ghs", ":Gitsigns stage_hunk<CR>", "Stage Hunk")
+ map({ "n", "v" }, "<leader>ghr", ":Gitsigns reset_hunk<CR>", "Reset Hunk")
+ map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
+ map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
+ map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
+ map("n", "<leader>ghp", gs.preview_hunk_inline, "Preview Hunk Inline")
+ map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
+ map("n", "<leader>ghB", function() gs.blame() end, "Blame Buffer")
+ map("n", "<leader>ghd", gs.diffthis, "Diff This")
+ map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
+ map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
+ Snacks.toggle({
+ name = "Git Signs",
+ get = function()
+ return require("gitsigns.config").config.signcolumn
+ end,
+ set = function(state)
+ require("gitsigns").toggle_signs(state)
+ end,
+ }):map("<leader>uG")
+ end,
+ },
+ },
+
+ -- TODO: currently unused plugins, check and enable/remove
+ { "MagicDuck/grug-far.nvim", enabled = false,
+ -- search/replace in multiple files
+ opts = { headerMaxWidth = 80 },
+ cmd = "GrugFar",
+ keys = {
+ {
+ "<leader>sr",
+ function()
+ local grug = require("grug-far")
+ local ext = vim.bo.buftype == "" and vim.fn.expand("%:e")
+ grug.open({
+ transient = true,
+ prefills = {
+ filesFilter = ext and ext ~= "" and "*." .. ext or nil,
+ },
+ })
+ end,
+ mode = { "n", "v" },
+ desc = "Search and Replace",
+ },
},
- config = function()
- require("telescope").load_extension("luasnip")
- end,
- keys = { { "<leader>ss", "<cmd>Telescope luasnip<cr>", desc = "Snippets" } },
},
- {
- "neo-tree.nvim",
- lazy = false,
+ { "folke/which-key.nvim",
+ -- which-key helps you remember key bindings by showing a popup
+ -- with the active keybindings of the command you started typing.
+ -- TODO: replace with mini.clue
+ event = "VeryLazy",
+ opts_extend = { "spec" },
opts = {
- filesystem = {
- -- TODO: review these
- bind_to_cwd = false,
- follow_current_file = {
- enabled = false,
+ preset = "helix",
+ defaults = {},
+ spec = {
+ {
+ mode = { "n", "v" },
+ { "<leader><tab>", group = "tabs" },
+ { "<leader>c", group = "code" },
+ { "<leader>d", group = "debug" },
+ { "<leader>dp", group = "profiler" },
+ { "<leader>f", group = "file/find" },
+ { "<leader>g", group = "git" },
+ { "<leader>gh", group = "hunks" },
+ { "<leader>q", group = "quit/session" },
+ { "<leader>s", group = "search" },
+ { "<leader>u", group = "ui", icon = { icon = " ", color = "cyan" } },
+ { "<leader>x", group = "diagnostics/quickfix", icon = { icon = " ", color = "green" } },
+ { "[", group = "prev" },
+ { "]", group = "next" },
+ { "g", group = "goto" },
+ { "gs", group = "surround" },
+ { "z", group = "fold" },
+ {
+ "<leader>b",
+ group = "buffer",
+ expand = function()
+ return require("which-key.extras").expand.buf()
+ end,
+ },
+ {
+ "<leader>w",
+ group = "windows",
+ proxy = "<c-w>",
+ expand = function()
+ return require("which-key.extras").expand.win()
+ end,
+ },
+ -- better descriptions
+ { "gx", desc = "Open with system app" },
},
},
},
- keys = function()
- local NeoTree = function(args)
- return function()
- require("neo-tree.command").execute(args)
- end
+ keys = {
+ {
+ "<leader>?",
+ function()
+ require("which-key").show({ global = false })
+ end,
+ desc = "Buffer Keymaps (which-key)",
+ },
+ {
+ "<c-w><space>",
+ function()
+ require("which-key").show({ keys = "<c-w>", loop = true })
+ end,
+ desc = "Window Hydra Mode (which-key)",
+ },
+ },
+ config = function(_, opts)
+ local wk = require("which-key")
+ wk.setup(opts)
+ if not vim.tbl_isempty(opts.defaults) then
+ LazyVim.warn("which-key: opts.defaults is deprecated. Please use opts.spec instead.")
+ wk.register(opts.defaults)
end
- return {
- { "<leader>fe", NeoTree({ toggle = true, dir = vim.loop.cwd() }) },
- }
end,
},
}