Neovim: update which-key configuration to v3
This commit is contained in:
parent
6fadc26aee
commit
661f71d1a8
12 changed files with 95 additions and 87 deletions
|
@ -1,35 +1,20 @@
|
|||
-- Display possible keybinds
|
||||
-- Here I have also defined some generic keybinds
|
||||
-- Plugin specific keybinds are set up in plugin configuration file
|
||||
|
||||
local function toggle_theme()
|
||||
local current_theme = vim.fn.eval("&background")
|
||||
if current_theme == "dark" then
|
||||
vim.cmd("set background=light")
|
||||
else
|
||||
vim.cmd("set background=dark")
|
||||
end
|
||||
end
|
||||
|
||||
--- @type LazyPluginSpec
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
local wk = require("which-key")
|
||||
wk.setup()
|
||||
|
||||
wk.register({
|
||||
h = { "<cmd>nohlsearch<cr>", "Turn off search highlight" },
|
||||
b = { toggle_theme, "Toggle background between dark and light" },
|
||||
co = { '<cmd>silent! execute "%bd|e#|bd#"<cr>', "Close other buffers" },
|
||||
}, { prefix = "<leader>" })
|
||||
|
||||
wk.register({
|
||||
["<Tab>"] = { "<cmd>bnext<cr>", "Next buffer" },
|
||||
["<S-Tab>"] = { "<cmd>bprevious<cr>", "Previous buffer" },
|
||||
require("which-key").add({
|
||||
{ "<leader>", group = "Leader" },
|
||||
{ "g", group = "Go to" },
|
||||
})
|
||||
|
||||
-- Exit terminal insert mode with esc
|
||||
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", {})
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue