dotfiles/home/.config/nvim/lua/plugins/which-key.lua

35 lines
922 B
Lua
Raw Normal View History

-- 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
2023-11-25 14:37:36 +02:00
--- @type LazyPluginSpec
return {
"folke/which-key.nvim",
config = function()
local wk = require("which-key")
wk.setup()
2023-06-27 12:39:51 +03:00
wk.register({
h = { "<cmd>nohlsearch<cr>", "Turn off search highlight" },
b = { toggle_theme, "Toggle background between dark and light" },
}, { prefix = "<leader>" })
2023-06-27 12:39:51 +03:00
wk.register({
["<C-n>"] = { "<cmd>bnext<cr>", "Next buffer" },
["<C-b>"] = { "<cmd>bprevious<cr>", "Previous buffer" },
})
2023-06-27 12:39:51 +03:00
-- Exit terminal insert mode with esc
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>", {})
end,
}