dotfiles/modules/programs/nvim/plugins/lua/which-key-nvim.lua

64 lines
1.4 KiB
Lua
Raw Normal View History

vim.o.timeout = true
vim.o.timeoutlen = 500
2023-06-10 21:52:57 +02:00
2023-09-10 13:30:29 +02:00
-- Delete
2023-06-10 21:52:57 +02:00
require("which-key").register({
2023-09-10 13:30:29 +02:00
d = {
name = "delete",
b = { "<cmd>bd<cr>", "Delete buffer" },
w = { "<C-w>c", "Delete window" },
2023-06-10 21:52:57 +02:00
},
}, { prefix = "<leader>" })
2023-09-10 13:30:29 +02:00
-- buffer
2023-06-10 21:52:57 +02:00
require("which-key").register({
["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
})
-- window
require("which-key").register({
w = {
name = "window",
["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" },
},
}, { prefix = "<leader>" })
-- better descriptions for navigation
require("which-key").register({
["<leader>"] = {
f = { name = "file/find" },
g = { name = "git" },
l = { name = "lsp" },
o = { name = "org" },
s = { name = "search" },
t = { name = "toggle" },
x = { name = "diagnostics/quickfix" },
},
["["] = { name = "prev" },
["]"] = { name = "next" },
g = { name = "goto" },
})
-- Clear search with <esc>
require("which-key").register({
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
})
-- better indenting
require("which-key").register({
["<"] = { "<gv", "Shift left" },
[">"] = { ">gv", "Shift right" },
}, { mode = "v" })
-- better yank in visual mode
require("which-key").register({
y = { "ygv<esc>", "Yank" },
}, { mode = "v" })