fixed which_key config to v3 update
This commit is contained in:
@ -23,26 +23,17 @@ which_key.setup({
|
|||||||
g = false, -- bindings for prefixed with g
|
g = false, -- bindings for prefixed with g
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- add operators that will trigger motion and text object completion
|
preset = "classic",
|
||||||
-- to enable all native operators, set the preset / operators plugin above
|
keys = {
|
||||||
operators = { gc = "Comments" },
|
|
||||||
key_labels = {
|
|
||||||
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
|
||||||
-- For example:
|
|
||||||
-- ["<space>"] = "SPC",
|
|
||||||
-- ["<cr>"] = "RET",
|
|
||||||
-- ["<tab>"] = "TAB",
|
|
||||||
},
|
|
||||||
popup_mappings = {
|
|
||||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||||
},
|
},
|
||||||
window = {
|
win = {
|
||||||
border = "single", -- none, single, double, shadow
|
-- border = "single", -- 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]
|
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||||
|
wo = {
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
layout = {
|
layout = {
|
||||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||||
@ -50,18 +41,13 @@ which_key.setup({
|
|||||||
spacing = 3, -- spacing between columns
|
spacing = 3, -- spacing between columns
|
||||||
align = "left", -- align columns left, center or right
|
align = "left", -- align columns left, center or right
|
||||||
},
|
},
|
||||||
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
|
filter = function(mapping) -- enable this to hide mappings for which you didn't specify a label
|
||||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
return mapping.desc
|
||||||
|
end,
|
||||||
show_help = true, -- show help message on the command line when the popup is visible
|
show_help = true, -- show help message on the command line when the popup is visible
|
||||||
show_keys = true, -- show the currently pressed key and its label as a message in the command line
|
show_keys = true, -- show the currently pressed key and its label as a message in the command line
|
||||||
triggers = "auto", -- automatically setup triggers
|
triggers = {
|
||||||
-- triggers = {"<leader>"} -- or specify a list manually
|
{ "<auto>", mode = "nxso" },
|
||||||
triggers_blacklist = {
|
|
||||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
|
||||||
-- this is mostly relevant for key maps that start with a native binding
|
|
||||||
-- most people should not need to change this
|
|
||||||
i = { "j", "k" },
|
|
||||||
v = { "j", "k" },
|
|
||||||
},
|
},
|
||||||
-- disable the WhichKey popup for certain buf types and file types.
|
-- disable the WhichKey popup for certain buf types and file types.
|
||||||
-- Disabled by default for Telescope
|
-- Disabled by default for Telescope
|
||||||
@ -71,121 +57,56 @@ which_key.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
which_key.register({
|
which_key.add({
|
||||||
name = "Hotkeys",
|
{ "<leader>", group = "Hotkeys" },
|
||||||
o = {
|
{ "<leader>o", ":Oil --float <CR>", desc = "Oil nvim toggle" },
|
||||||
":Oil --float <CR>",
|
{ "<leader>e", ":Neotree toggle <CR>", desc = "File tree toggle" },
|
||||||
"Oil nvim toggle",
|
{ "<leader>F", ":lua vim.lsp.buf.format() <CR>", desc = "Format file" },
|
||||||
},
|
})
|
||||||
e = {
|
|
||||||
":Neotree toggle <CR>",
|
|
||||||
"File tree toggle",
|
|
||||||
},
|
|
||||||
F = {
|
|
||||||
":lua vim.lsp.buf.format() <CR>",
|
|
||||||
"Format file",
|
|
||||||
},
|
|
||||||
f = {
|
|
||||||
name = "Find",
|
|
||||||
f = {
|
|
||||||
"<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>",
|
|
||||||
"Find file",
|
|
||||||
},
|
|
||||||
w = {
|
|
||||||
"<cmd>lua require'telescope.builtin'.live_grep()<cr>",
|
|
||||||
"Grep file",
|
|
||||||
},
|
|
||||||
b = {
|
|
||||||
"<cmd>lua require'telescope.builtin'.buffers()<cr>",
|
|
||||||
"Find buffer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
c = {
|
|
||||||
name = "Code actions",
|
|
||||||
a = {
|
|
||||||
"<cmd>lua vim.lsp.buf.code_action()<CR>",
|
|
||||||
"Show code actions",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
l = {
|
|
||||||
"<cmd>lua vim.diagnostic.setloclist()<CR>",
|
|
||||||
"Show diagnostic list",
|
|
||||||
},
|
|
||||||
d = {
|
|
||||||
name = "DAP",
|
|
||||||
r = {
|
|
||||||
"<cmd>DapContinue<CR>",
|
|
||||||
"DapContinue",
|
|
||||||
},
|
|
||||||
j = {
|
|
||||||
"<cmd>DapStepInto<CR>",
|
|
||||||
"StepInto",
|
|
||||||
},
|
|
||||||
l = {
|
|
||||||
"<cmd>DapStepOver<CR>",
|
|
||||||
"StepOver",
|
|
||||||
},
|
|
||||||
k = {
|
|
||||||
"<cmd>DapStepOut<CR>",
|
|
||||||
"StepOut",
|
|
||||||
},
|
|
||||||
b = {
|
|
||||||
"<cmd>DapToggleBreakpoint<CR>",
|
|
||||||
"Toggle breakpoint",
|
|
||||||
},
|
|
||||||
s = {
|
|
||||||
"<cmd>DapTerminate<CR>",
|
|
||||||
"Terminate",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
t = {
|
|
||||||
name = "Tabs",
|
|
||||||
n = {
|
|
||||||
"<cmd>tabnew<CR>",
|
|
||||||
"New tab",
|
|
||||||
},
|
|
||||||
q = {
|
|
||||||
"<cmd>tabclose<CR>",
|
|
||||||
"Close tab",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}, { prefix = "<leader>" })
|
|
||||||
|
|
||||||
which_key.register({
|
which_key.add({
|
||||||
name = "LSP Actions",
|
{ "<leader>f", group = "Find" },
|
||||||
D = {
|
{ "<leader>ff", "<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>", desc = "Find file" },
|
||||||
"<cmd>lua vim.lsp.buf.declaration()<CR>",
|
{ "<leader>fw", "<cmd>lua require'telescope.builtin'.live_grep()<cr>", desc = "Grep file" },
|
||||||
"Go to declaration",
|
{ "<leader>fb", "<cmd>lua require'telescope.builtin'.buffers()<cr>", desc = "Find buffer" },
|
||||||
},
|
})
|
||||||
d = {
|
|
||||||
"<cmd>lua vim.lsp.buf.definition()<CR>",
|
|
||||||
"Go to definition",
|
|
||||||
},
|
|
||||||
i = {
|
|
||||||
"<cmd>lua vim.lsp.buf.implementation()<CR>",
|
|
||||||
"Show implementations",
|
|
||||||
},
|
|
||||||
rr = {
|
|
||||||
"<cmd>lua vim.lsp.buf.rename()<CR>",
|
|
||||||
"Rename",
|
|
||||||
},
|
|
||||||
r = {
|
|
||||||
"<cmd>lua vim.lsp.buf.references()<CR>",
|
|
||||||
"Show references",
|
|
||||||
},
|
|
||||||
l = {
|
|
||||||
"<cmd>lua vim.diagnostic.open_float({ border = 'rounded' })<CR>",
|
|
||||||
"Show diagnostic at line",
|
|
||||||
},
|
|
||||||
}, { prefix = "g" })
|
|
||||||
|
|
||||||
which_key.register({
|
which_key.add({
|
||||||
["<C-k>"] = {
|
{ "<leader>c", group = "Code actions" },
|
||||||
"<cmd>lua vim.lsp.buf.signature_help()<CR>",
|
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", desc = "Show code actions" },
|
||||||
"Signature help",
|
})
|
||||||
},
|
|
||||||
["K"] = {
|
which_key.add({
|
||||||
"<cmd>lua vim.lsp.buf.hover()<CR>",
|
{ "<leader>l", "<cmd>lua vim.diagnostic.setloclist()<CR>", desc = "Show diagnostic list" },
|
||||||
"Signature help",
|
})
|
||||||
},
|
|
||||||
}, {})
|
which_key.add({
|
||||||
|
{ "<leader>d", group = "Dap" },
|
||||||
|
{ "<leader>dr", "<cmd>DapContinue<CR>", desc = "Continue" },
|
||||||
|
{ "<leader>dj", "<cmd>DapStepInto<CR>", desc = "Step into" },
|
||||||
|
{ "<leader>dl", "<cmd>DapStepOver<CR>", desc = "Step over" },
|
||||||
|
{ "<leader>dk", "<cmd>DapStepOut<CR>", desc = "Step out" },
|
||||||
|
{ "<leader>db", "<cmd>DapToggleBreakpoint<CR>", desc = "Toggle breakpoint" },
|
||||||
|
{ "<leader>ds", "<cmd>DapTerminate<CR>", desc = "Terminate" },
|
||||||
|
})
|
||||||
|
|
||||||
|
which_key.add({
|
||||||
|
{ "<leader>t", group = "Tabs" },
|
||||||
|
{ "<leader>tn", "<cmd>lua vim.lsp.buf.declaration()<CR>", desc = "New tab" },
|
||||||
|
{ "<leader>tq", "<cmd>lua vim.lsp.buf.definition()<CR>", desc = "Close tab" },
|
||||||
|
})
|
||||||
|
|
||||||
|
which_key.add({
|
||||||
|
{ "g", group = "LSP Actions" },
|
||||||
|
{ "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", desc = "Go to declaration" },
|
||||||
|
{ "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", desc = "Go to definition" },
|
||||||
|
{ "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", desc = "Show implementations" },
|
||||||
|
{ "grr", "<cmd>lua vim.lsp.buf.rename()<CR>", desc = "Rename" },
|
||||||
|
{ "gr", "<cmd>lua vim.lsp.buf.references()<CR>", desc = "Show references" },
|
||||||
|
{ "gl", "<cmd>lua vim.diagnostic.open_float({ border = 'rounded' })<CR>", desc = "Show diagnostic at line" },
|
||||||
|
})
|
||||||
|
|
||||||
|
which_key.add({
|
||||||
|
{ "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", desc = "Signature help" },
|
||||||
|
{ "K", "<cmd>lua vim.lsp.buf.hover()<CR>", desc = "Signature help" },
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user