return { { "folke/which-key.nvim", event = "VeryLazy", opts = { 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? }, }, key_labels = { -- override the label used to display some keys. It doesn't effect WK in any other way. [""] = "SPC", }, 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 }, popup_mappings = { scroll_down = "", -- binding to scroll down inside the popup scroll_up = "", -- binding to scroll up inside the popup }, window = { border = "rounded", -- none, single, double, shadow position = "bottom", -- bottom, top margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] winblend = 0, }, 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) local leader_opts = { mode = { "n", "v" }, -- NORMAL/VISUAL mode buffer = nil, -- Global mappings prefix = "", silent = true, -- use 'silent' noremap = true, -- use 'noremap' nowait = true, -- use 'nowait' } whichkey.register({ mode = { "n", "v" }, ["g"] = { name = "+goto" }, ["m"] = { name = "+harpoon" }, ["]"] = { name = "+next" }, ["["] = { name = "+previous" }, }) local leader_mappings = { b = { name = "+buffer" }, r = { name = "+replace" }, s = { name = "+search" }, h = { name = "+help" }, gh = { name = "+hunks" }, t = { name = "+todo" }, N = { name = "+noice" }, Z = { "ZenMode", "Zen" }, u = { "UndotreeToggle", "Undo Tree" }, ["'"] = { "close", "Close split" }, -- c = { -- name = "+copilot", -- c = { "Copilot enable", "Enable Copilot" }, -- d = { "Copilot disable", "Disable Copilot" }, -- t = { "Copilot toggle", "Toggle Copilot" }, -- }, 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", }, }, q = { name = "+quit", q = { "wq", "Save and Quit Current" }, a = { "wqa", "Save and Quit all" }, ['!'] = { "qa!", "Force Quit all" }, }, l = { name = "+lsp", l = { "lopen", "Open Location List" }, q = { "copen", "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" }, }, w = { name = "+window", w = { "p", "Other window" }, d = { "c", "Delete Window" }, h = { "s", "Split Below" }, v = { "v", "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", }, }, 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)", }, }, z = { name = "+zk", I = { "ZkIndex", "Index Notebook" }, n = { "+new", n = { "ZkNew { title = vim.fn.input('Title: ') }", "New Note (zk dir)" }, N = { "ZkNew { dir = vim.fn.expand('%:p:h'), title = vim.fn.input('Title: ') }", "New Note (cwd)", }, t = { "ZkNewFromTitleSelection { title = vim.fn.input('Title: ') }", "New, Title from selection (zk dir)", }, T = { "ZkNewFromTitleSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }", "New, Title from selection (cwd)", }, c = { "ZkNewFromContentSelection { title = vim.fn.input('Title: ') }", "New, Content from selection (zk dir)", }, C = { "ZkNewFromContentSelection { dir = vim.fn.expand('%:p:h') title = vim.fn.input('Title: ') }", "New, Content from selection (cwd)", }, }, c = { "ZkCd", "cd 'root'" }, s = { "ZkNotes", "List Notes" }, b = { "ZkBacklinks", "Backlinks" }, l = { "ZkLinks", "Links" }, j = { "ZkNew { dir = 'journal', date = 'today', title = vim.fn.input('Title: ') }", "New Journal", }, i = { { "ZkInsertLink", "Insert Link" }, }, }, -- TODO: Add dap back into the project, bashbunni's dotfiles are a good resource. -- d = { -- name = "Debug", -- b = { "lua require'dap'.toggle_breakpoint()", "Breakpoint" }, -- c = { "lua require'dap'.continue()", "Continue" }, -- i = { "lua require'dap'.step_into()", "Into" }, -- o = { "lua require'dap'.step_over()", "Over" }, -- O = { "lua require'dap'.step_out()", "Out" }, -- r = { "lua require'dap'.repl.toggle()", "Repl" }, -- l = { "lua require'dap'.run_last()", "Last" }, -- u = { "lua require'dapui'.toggle()", "UI" }, -- x = { "lua require'dap'.terminate()", "Exit" }, -- }, } whichkey.register(leader_mappings, leader_opts) end, }, }