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

51 lines
1.4 KiB
Lua

vim.o.timeout = true
vim.o.timeoutlen = 500
-- Delete
require("which-key").add({
{ "<leader>d", group = "delete" },
{ "<leader>db", "<cmd>bd<cr>", desc = "Delete buffer" },
{ "<leader>dw", "<C-w>c", desc = "Delete window" },
})
-- buffer
require("which-key").add({
{ "[b", "<cmd>bprevious<cr>", desc = "Previous buffer" },
{ "]b", "<cmd>bnext<cr>", desc = "Next buffer" },
})
-- window
require("which-key").add({
{ "<leader>w", group = "window" },
{ "<leader>w-", "<C-w>s", desc = "Split window vertically" },
{ "<leader>ww", "<C-w>w", desc = "Switch window" },
{ "<leader>w|", "<C-w>v", desc = "Split window horizontally" },
})
-- better descriptions for navigation
require("which-key").add({
{ "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>s", group = "search" },
{ "<leader>t", group = "toggle" },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
})
-- Clear search with <esc>
require("which-key").add({
{ "<esc>", "<cmd>noh<cr><esc>", desc = "Escape and clear hlsearch", mode = { "i", "n" } },
})
-- better indenting
require("which-key").add({
{ "<", "<gv", desc = "Shift left", mode = "v" },
{ ">", ">gv", desc = "Shift right", mode = "v" },
})
-- better yank in visual mode
require("which-key").add({
{ "y", "ygv<esc>", desc = "Yank", mode = "v" },
})