feat(nvim): toggle terminal as a split via <leader>t{h,v}
replace the floating `Ctrl-\` toggle (unergonomic on a German layout) with `<leader>th`/`<leader>tv` for horizontal/vertical splits; `<C-w>` in the terminal leaves to normal mode in one chord. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+13
-4
@@ -199,13 +199,14 @@ in
|
|||||||
# consumer wanting auto-restore on a bare `nvim` adds a VimEnter autocmd.
|
# consumer wanting auto-restore on a bare `nvim` adds a VimEnter autocmd.
|
||||||
persistence.enable = true;
|
persistence.enable = true;
|
||||||
|
|
||||||
# Floating terminal toggled with Ctrl-\ (shares nvim's cwd). Try it; if
|
# Terminal split (shares nvim's cwd), toggled via <leader>t{h,v} below.
|
||||||
# a tiled foot next to nvim serves you better, drop this block.
|
# No open_mapping — the leader binds cover both directions; size applies
|
||||||
|
# to whichever split is open (rows when horizontal, cols when vertical).
|
||||||
toggleterm = {
|
toggleterm = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
open_mapping = { __raw = "[[<c-\\>]]"; };
|
direction = "horizontal";
|
||||||
direction = "float";
|
size = 15;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -221,6 +222,7 @@ in
|
|||||||
{ __unkeyed-1 = "<leader>c"; group = "Code"; }
|
{ __unkeyed-1 = "<leader>c"; group = "Code"; }
|
||||||
{ __unkeyed-1 = "<leader>r"; group = "Refactor"; }
|
{ __unkeyed-1 = "<leader>r"; group = "Refactor"; }
|
||||||
{ __unkeyed-1 = "<leader>s"; group = "Search"; }
|
{ __unkeyed-1 = "<leader>s"; group = "Search"; }
|
||||||
|
{ __unkeyed-1 = "<leader>t"; group = "Terminal"; }
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -251,6 +253,13 @@ in
|
|||||||
{ mode = "n"; key = "<S-h>"; action = "<cmd>bprevious<cr>"; options.desc = "Prev buffer"; }
|
{ mode = "n"; key = "<S-h>"; action = "<cmd>bprevious<cr>"; options.desc = "Prev buffer"; }
|
||||||
{ mode = "n"; key = "<leader>bd"; action = "<cmd>bdelete<cr>"; options.desc = "Close buffer"; }
|
{ mode = "n"; key = "<leader>bd"; action = "<cmd>bdelete<cr>"; options.desc = "Close buffer"; }
|
||||||
|
|
||||||
|
# Terminal: toggle a horizontal or vertical split (toggleterm). Same key
|
||||||
|
# hides it again. From inside the terminal, <C-w> drops to normal mode and
|
||||||
|
# runs the window command, so leaving is one chord (no <C-\><C-n> dance).
|
||||||
|
{ mode = "n"; key = "<leader>th"; action = "<cmd>ToggleTerm direction=horizontal<cr>"; options.desc = "Terminal (horizontal)"; }
|
||||||
|
{ mode = "n"; key = "<leader>tv"; action = "<cmd>ToggleTerm direction=vertical size=80<cr>"; options.desc = "Terminal (vertical)"; }
|
||||||
|
{ mode = "t"; key = "<C-w>"; action = ''<C-\><C-n><C-w>''; options.desc = "Leave terminal to window"; }
|
||||||
|
|
||||||
# Cheatsheet: <leader>? pops the full which-key list; <leader>sk fuzzy-
|
# Cheatsheet: <leader>? pops the full which-key list; <leader>sk fuzzy-
|
||||||
# searches every active mapping via Telescope (catches non-leader binds too).
|
# searches every active mapping via Telescope (catches non-leader binds too).
|
||||||
{ mode = "n"; key = "<leader>?"; action = "<cmd>WhichKey<cr>"; options.desc = "All keybinds (which-key)"; }
|
{ mode = "n"; key = "<leader>?"; action = "<cmd>WhichKey<cr>"; options.desc = "All keybinds (which-key)"; }
|
||||||
|
|||||||
Reference in New Issue
Block a user