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

52 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
2024-08-18 13:03:18 +02:00
require("which-key").add({
{ "<leader>d", group = "delete" },
{ "<leader>db", "<cmd>bd<cr>", desc = "Delete buffer" },
{ "<leader>dw", "<C-w>c", desc = "Delete window" },
})
2023-09-10 13:30:29 +02:00
-- buffer
2024-08-18 13:03:18 +02:00
require("which-key").add({
{ "[b", "<cmd>bprevious<cr>", desc = "Previous buffer" },
{ "]b", "<cmd>bnext<cr>", desc = "Next buffer" },
2023-06-10 21:52:57 +02:00
})
-- window
2024-08-18 13:03:18 +02:00
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" },
})
2023-06-10 21:52:57 +02:00
-- better descriptions for navigation
2024-08-18 13:03:18 +02:00
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" },
2023-06-10 21:52:57 +02:00
})
-- Clear search with <esc>
2024-08-18 13:03:18 +02:00
require("which-key").add({
{ "<esc>", "<cmd>noh<cr><esc>", desc = "Escape and clear hlsearch", mode = { "i", "n" } },
2023-06-10 21:52:57 +02:00
})
-- better indenting
2024-08-18 13:03:18 +02:00
require("which-key").add({
{ "<", "<gv", desc = "Shift left", mode = "v" },
{ ">", ">gv", desc = "Shift right", mode = "v" },
})
-- better yank in visual mode
2024-08-18 13:03:18 +02:00
require("which-key").add({
{ "y", "ygv<esc>", desc = "Yank", mode = "v" },
})