return { "folke/which-key.nvim", enabled = true, dependencies = { "echasnovski/mini.icons" }, event = "VeryLazy", opts = { preset = "modern", plugins = { -- marks = true, -- shows a list of your marks on ' and ` -- registers = true, -- shows your registers on " in NORMAL or in INSERT mode spelling = { enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions suggestions = 20, -- how many suggestions should be shown in the list? }, }, icons = { breadcrumb = "»", -- symbol used in the command line area that shows your active key combo separator = "➜", -- symbol used between a key and it's label group = "+", -- symbol prepended to a group }, keys = { scroll_down = "", -- binding to scroll down inside the popup scroll_up = "", -- binding to scroll up inside the popup }, layout = { height = { min = 4, max = 25 }, -- min and max height of the columns width = { min = 20, max = 50 }, -- min and max width of the columns spacing = 3, -- spacing between columns align = "center", -- align columns left, center or right }, }, config = function(_, opts) local whichkey = require("which-key") local utils = require("lazyvim.utils") whichkey.setup(opts) -- whichkey.add({ -- mode = { "n", "v" }, -- ["g"] = { name = "+goto" }, -- ["m"] = { name = "+harpoon" }, -- ["]"] = { name = "+next" }, -- ["["] = { name = "+previous" }, -- }) whichkey.add({ mode = { "n", "v" }, { "g", group = "goto" }, { "m", group = "harpoon" }, { "]", group = "next" }, { "[", group = "previous" } }) -- b = { name = "+buffer" }, -- r = { name = "+replace" }, -- s = { name = "+search" }, -- h = { name = "+help" }, -- gh = { name = "+hunks" }, -- t = { name = "+todo" }, -- N = { name = "+noice" }, whichkey.add({ mode = { "n", "v" }, { "b", group = "buffer" }, { "r", group = "replace" }, { "s", group = "search" }, { "h", group = "help" }, { "gh", group = "hunks" }, { "t", group = "todo" }, { "N", group = "noice" }, { "f", group = "files" }, { "a", group = "angular" }, { "T", group = "term" }, }) whichkey.add({ mode = { "n", "v" }, { "bt", function() require "lazyvim.utils".trim_whitespace() end, desc = "Trim whitespace from current buffer" }, }) -- Z = { "ZenMode", "Zen" }, -- u = { "UndotreeToggle", "Undo Tree" }, -- ["'"] = { "close", "Close split" }, whichkey.add({ mode = { "n", "v" }, { "Z", "ZenMode", desc = "Zen" }, { "u", "UndotreeToggle", desc = "Undetree" }, { "'", "close", desc = "Close Split" }, }) -- n = { -- name = "+neorg", -- n = { "Neorg", "Open Neorg" }, -- c = { "Neorg toggle-concealer", "Toggle Concealer" }, -- t = { "Neorg tangle current-file", "Tangle Current File" }, -- j = { "Neorg journal", "Open Neorg Journal" }, -- w = { -- function() -- require("lazyvim.utils.neorg").workspace_switcher() -- end, -- "Workspace Switcher", -- }, -- }, whichkey.add({ mode = { "n", "v" }, { "n", group = "neorg" }, { "nn", "Neorg", desc = "Open Neorg" }, { "nc", "Neorg toggle-concealer", desc = "Toggle Concealer" }, { "nt", "Neorg tangle current-file", desc = "Tangle Current File" }, { "nj", "Neorg journal", desc = "Open Neorg Journal" }, { "nw", function() require("lazyvim.utils.neorg").workspace_switcher() end , desc = "Workspace Switcher" }, }) -- q = { -- name = "+quit", -- q = { "wq", "Save and Quit Current" }, -- a = { "wqa", "Save and Quit all" }, -- ['!'] = { "qa!", "Force Quit all" }, -- }, whichkey.add({ mode = { "n", "v" }, { "q", group = "quit" }, { "qq", "wq", desc = "Save and Quit Current" }, { "qa", "wqa", desc = "Save and Quit all" }, { "q!", "qa!", desc = "Force Quit all" }, }) -- l = { -- name = "+lsp", -- l = { "lopen", "Open Location List" }, -- q = { "copen", "Open Quickfix List" }, -- x = { "cclose", "Close Quickfix List" }, -- }, whichkey.add({ mode = { "n", "v" }, { "l", group = "lsp" }, { "ll", "lopen", desc = "Open Location List" }, { "lq", "copen", desc = "Open Quickfix List" }, { "lx", function() vim.diagnostic.setqflist() end, desc = "Open Quickfix List" }, }) -- C = { -- name = "+compiler", -- c = { "w! | !compiler %", "Compile File" }, -- b = { "w! | !pandoc % -t beamer -o presentation.pdf", "Beamer Presentation" }, -- p = { "!opout %", "Preview Document" }, -- }, whichkey.add({ mode = { "n", "v" }, { "c", group = "compiler" }, { "cc", "w! | !compiler %", desc = "Compile File" }, { "cb", "w! | !pandoc % -t beamer -o presentation.pdf", desc = "Beamer Presentation" }, { "cp", "!opout %", desc = "Preview Document" }, }) -- w = { -- name = "+window", -- w = { "p", "Other window" }, -- d = { "c", "Delete Window" }, -- h = { "s", "Split Below" }, -- v = { "v", "Split Right" }, -- }, whichkey.add({ mode = { "n", "v" }, { "w", group = "window" }, { "ww", "p", desc = "Other window" }, { "wd", "c", desc = "Delete Window" }, { "wh", "s", desc = "Split Below" }, { "wv", "v", desc = "Split Right" }, }) -- o = { -- name = "+option", -- f = { -- function() -- require("lazyvim.plugins.lsp.format").toggle() -- end, -- "Toggle format on save", -- }, -- s = { -- function() -- utils.toggle("spell") -- end, -- "Toggle spelling", -- }, -- w = { -- function() -- utils.toggle("wrap") -- end, -- "Toggle word wrap", -- }, -- n = { -- function() -- utils.toggle("relativenumber", true) -- utils.toggle("number") -- end, -- "Toggle line numbers", -- }, -- d = { -- function() -- utils.toggle_diagnostics() -- end, -- "Toggle Diagnostics", -- }, -- c = { -- function() -- local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 -- utils.toggle("conceallevel", false, { 0, conceallevel }) -- end, -- "Toggle conceal", -- }, -- h = { -- function() -- local sidescrolloff = vim.o.sidescrolloff > 0 and vim.o.sidescrolloff or 8 -- utils.toggle("sidescrolloff", false, { 0, sidescrolloff }) -- end, -- "Toggle side scroll off", -- }, -- }, whichkey.add({ mode = { "n", "v" }, { "o", group = "option" }, { "of", function() require("lazyvim.plugins.lsp.format").toggle() end, desc = "Toggle format on save" }, { "os", function() utils.toggle("spell") end, desc = "Toggle spelling" }, { "ow", function() utils.toggle("wrap") end, desc = "Toggle word wrap" }, { "on", function() utils.toggle("relativenumber", true) utils.toggle("number") end, desc = "Toggle line numbers" }, { "od", function() utils.toggle_diagnostics() end, desc = "Toggle diagnostics" }, { "oc", function() utils.toggle("conceallevel", false, { 0, 3 }) end, desc = "Toggle conceal" }, { "oh", function() local sidescrolloff = vim.o.sidescrolloff > 0 and vim.o.sidescrolloff or 8 utils.toggle("sidescrolloff", false, { 0, sidescrolloff }) end, desc = "Toggle side scroll" }, }) -- g = { -- name = "+git", -- g = { -- function() -- utils.float_term({ "lazygit" }) -- end, -- "Lazygit (cwd)", -- }, -- G = { -- function() -- utils.float_term({ "lazygit" }, { cwd = utils.get_root() }) -- end, -- "Lazygit (root dir)", -- }, -- }, whichkey.add({ mode = { "n", "v" }, { "g", group = "git" }, { "gg", function() utils.float_term({ "lazygit" }) end , desc = "Lazygit (cwd)" }, { "gG", function() utils.float_term({ "lazygit" }, { cwd = utils.get_root() }) end , desc = "Lazygit (root)" }, }) -- z = { -- name = "+zk", -- I = { "ZkIndex", "Index Notebook" }, -- s = { "ZkNotes", "List Notes" }, -- b = { "ZkBacklinks", "Backlinks" }, -- l = { "ZkLinks", "Links" }, -- i = { -- { "ZkInsertLink", "Insert Link" }, -- }, -- }, whichkey.add({ mode = { "n", "v" }, { "z", group = "zk" }, { "zI", "ZkIndex", desc = "Index Notebook" }, { "zs", "ZkNotes", desc = "List Notes" }, { "zb", "ZkBacklinks", desc = "Backlinks" }, { "zl", "ZkLinks", desc = "Links" }, { "zi", "ZkInsertLink", desc = "Insert Link" }, }) end, }