nixvim-config/config/keymaps/windows.nix
jasmine f6f92ec15e
refactor: reorganize keymaps into semantic namespaces
Restructure keybindings for improved discoverability and consistency
with WezTerm/XMonad configurations. Separate keymaps from plugin
configurations following single responsibility principle.

Changes:
- Create keymaps/ directory with semantic grouping:
  - general.nix: leader setup, page navigation
  - buffers.nix: buffer operations (bq, bQ, bl)
  - windows.nix: window operations (ws, wv, wq, wQ, wm)
  - find.nix: telescope find operations (ff, fg, fh, fc)
  - git.nix: unified git operations from gitsigns/fugitive/telescope

- Adopt consistent q/Q pattern across containers:
  - bq/bQ for buffer quit (current/all others)
  - wq/wQ for window quit (current/all others)
  - Mirrors WezTerm's LEADER+p q / LEADER+t q pattern

- Extract keymaps from plugin files:
  - telescope.nix: config only, keymaps moved to find.nix
  - fugitive.nix: config only, keymaps moved to git.nix
  - gitsigns.nix: config only, keymaps moved to git.nix
  - snacks.nix: config only, keymaps moved to buffers.nix
  - maximize.nix: config only, keymap moved to windows.nix

- Remove smart-splits.nix (functionality replaced by native window ops)

- Maintain navigation on dedicated modifiers (Ctrl+arrows/PageUp/PageDown)
  for consistency with WezTerm (ALT) and XMonad (Super)
2025-10-03 16:39:39 +08:00

110 lines
1.9 KiB
Nix

{...}: {
keymaps = [
# Window namespace indicator for whichkey
{
mode = ["n"];
key = "<leader>w";
action = "<NOP>";
options = {
desc = "+window";
};
}
# Window splits
{
mode = ["n"];
key = "<leader>ws";
action = "<C-w>s";
options = {
desc = "Split window horizontally";
silent = true;
};
}
{
mode = ["n"];
key = "<leader>wv";
action = "<C-w>v";
options = {
desc = "Split window vertically";
silent = true;
};
}
# Window closing
{
mode = ["n"];
key = "<leader>wq";
action = "<C-w>q";
options = {
desc = "Quit window";
silent = true;
};
}
{
mode = ["n"];
key = "<leader>wQ";
action = "<C-w>o";
options = {
desc = "Quit all other windows";
silent = true;
};
}
# Window maximize
{
mode = ["n"];
key = "<leader>wm";
action = {
__raw = "require('maximize').toggle";
};
options = {
desc = "Toggle maximize window";
silent = true;
};
}
# Cycle through splits
{
mode = ["n"];
key = "<C-Up>";
action = "<C-w>W";
options = {
desc = "Cycle to previous split";
silent = true;
};
}
{
mode = ["n"];
key = "<C-Down>";
action = "<C-w>w";
options = {
desc = "Cycle to next split";
silent = true;
};
}
# Rotate split layout
{
mode = ["n"];
key = "<C-PageUp>";
action = "<C-w>R";
options = {
desc = "Rotate splits counter-clockwise";
silent = true;
};
}
{
mode = ["n"];
key = "<C-PageDown>";
action = "<C-w>r";
options = {
desc = "Rotate splits clockwise";
silent = true;
};
}
];
}