synix/modules/home/nixvim/keymaps.nix
sid b950eb138e
All checks were successful
Flake check / flake-check (pull_request) Successful in 23s
Build tests / build-hosts (pull_request) Successful in 32s
nixvim: add diffview, gitsigns, which-key. re-enable treesitter. document some keymaps
2026-05-05 20:26:46 +02:00

256 lines
5 KiB
Nix

[
{
options.desc = "scroll down, recenter";
key = "<C-d>";
action = "<C-d>zz";
mode = "n";
}
{
options.desc = "scroll up, recenter";
key = "<C-u>";
action = "<C-u>zz";
mode = "n";
}
{
options.desc = "center cursor after search next";
key = "n";
action = "nzzzv";
mode = "n";
}
{
options.desc = "center cursor after search previous";
key = "N";
action = "Nzzzv";
mode = "n";
}
{
options.desc = "ex command";
key = "<leader>pv";
action = "<cmd>Ex<CR>";
mode = "n";
}
{
options.desc = "search and replace word under cursor";
key = "<leader>s";
action = ":%s/<C-r><C-w>/<C-r><C-w>/gI<Left><Left><Left>";
mode = "n";
}
{
key = "<leader>s";
action = "y:%s/<C-r>0/<C-r>0/gI<Left><Left><Left>";
mode = "v";
}
{
options.desc = "copy to system clipboard in visual mode";
key = "<C-c>";
action = ''"+y '';
mode = "v";
}
{
options.desc = "paste from system clipboard in visual mode";
key = "<C-v>";
action = ''"+p '';
mode = "v";
}
{
options.desc = "yank to system clipboard";
key = "<leader>Y";
action = "+Y";
mode = "n";
}
{
options.desc = "replace selected text with clipboard content";
key = "<leader>p";
action = "_dP";
mode = "x";
}
{
options.desc = "delete without copying to clipboard";
key = "<leader>d";
action = "_d";
mode = [
"n"
"v"
];
}
{
options.desc = "move lines down in visual mode";
key = "J";
action = ":m '>+1<CR>gv=gv";
mode = "v";
}
{
options.desc = "move lines up in visual mode";
key = "K";
action = ":m '<-2<CR>gv=gv";
mode = "v";
}
{
options.desc = "join lines";
key = "J";
action = "mzJ`z";
mode = "n";
}
{
options.desc = "Run make command";
key = "<leader>m";
action = "<cmd>:make<CR>";
mode = "n";
}
{
options.desc = "previous quickfix item";
key = "<C-A-J>";
action = "<cmd>cprev<CR>zz";
mode = "n";
}
{
options.desc = "next quickfix item";
key = "<C-A-K>";
action = "<cmd>cnext<CR>zz";
mode = "n";
}
{
options.desc = "previous location list item";
key = "<leader>j";
action = "<cmd>lprev<CR>zz";
mode = "n";
}
{
options.desc = "next location list item";
key = "<leader>k";
action = "<cmd>lnext<CR>zz";
mode = "n";
}
{
options.desc = "disable the 'Q' key";
key = "Q";
action = "<nop>";
mode = "n";
}
{
options.desc = "select whole buffer";
key = "<C-a>";
action = "ggVG";
mode = "n";
}
{
options.desc = "focus next window";
key = "<C-j>";
action = ":wincmd W<CR>";
mode = "n";
}
{
options.desc = "focus next window";
key = "<Tab>";
action = ":wincmd W<CR>";
mode = "n";
}
{
options.desc = "focus previous window";
key = "<C-k>";
action = ":wincmd w<CR>";
mode = "n";
}
{
options.desc = "focus previous window";
key = "<S-Tab>";
action = ":wincmd w<CR>";
mode = "n";
}
{
options.desc = "increase window width";
key = "<C-l>";
action = ":vertical resize +5<CR>";
mode = "n";
}
{
options.desc = "decrease window width";
key = "<C-h>";
action = ":vertical resize -5<CR>";
mode = "n";
}
{
options.desc = "close current window";
key = "<leader-S>c";
action = ":q<CR>";
mode = "n";
}
{
options.desc = "new vertical split at $HOME";
key = "<leader>n";
action = ":vsp $HOME<CR>";
mode = "n";
}
{
options.desc = "toggle split orientation";
key = "<leader>t";
action = ":wincmd T<CR>";
mode = "n";
}
{
options.desc = "toggle spell checking";
key = "<leader>ss";
action = ":setlocal spell!<CR>";
mode = "n";
}
{
options.desc = "switch to english spell checking";
key = "<leader>se";
action = ":setlocal spelllang=en_us<CR>";
mode = "n";
}
{
options.desc = "switch to german spell checking";
key = "<leader>sg";
action = ":setlocal spelllang=de_20<CR>";
mode = "n";
}
{
options.desc = "move to next misspelling";
key = "]s";
action = "]szz";
mode = "n";
}
{
options.desc = "move to previous misspelling";
key = "[s";
action = "[szz";
mode = "n";
}
{
options.desc = "correction suggestions for a misspelled word";
key = "z=";
action = "z=";
mode = "n";
}
{
options.desc = "adding words to the dictionary";
key = "zg";
action = "zg";
mode = "n";
}
{
options.desc = "next buffer";
key = "<C-S-J>";
action = ":bnext<CR>";
mode = "n";
}
{
options.desc = "previous buffer";
key = "<C-S-K>";
action = ":bprevious<CR>";
mode = "n";
}
{
options.desc = "close current buffer";
key = "<leader>bd";
action = ":bdelete<CR>";
mode = "n";
}
{
options.desc = "apply code action";
key = "<leader>ca";
action = ":lua vim.lsp.buf.code_action()<CR>";
mode = "n";
}
]