diff --git a/modules/nvim.nix b/modules/nvim.nix index 24d920e..cc0d59c 100644 --- a/modules/nvim.nix +++ b/modules/nvim.nix @@ -199,13 +199,14 @@ in # consumer wanting auto-restore on a bare `nvim` adds a VimEnter autocmd. persistence.enable = true; - # Floating terminal toggled with Ctrl-\ (shares nvim's cwd). Try it; if - # a tiled foot next to nvim serves you better, drop this block. + # Terminal split (shares nvim's cwd), toggled via t{h,v} below. + # No open_mapping — the leader binds cover both directions; size applies + # to whichever split is open (rows when horizontal, cols when vertical). toggleterm = { enable = true; settings = { - open_mapping = { __raw = "[[]]"; }; - direction = "float"; + direction = "horizontal"; + size = 15; }; }; @@ -221,6 +222,7 @@ in { __unkeyed-1 = "c"; group = "Code"; } { __unkeyed-1 = "r"; group = "Refactor"; } { __unkeyed-1 = "s"; group = "Search"; } + { __unkeyed-1 = "t"; group = "Terminal"; } ]; }; }; @@ -251,6 +253,13 @@ in { mode = "n"; key = ""; action = "bprevious"; options.desc = "Prev buffer"; } { mode = "n"; key = "bd"; action = "bdelete"; options.desc = "Close buffer"; } + # Terminal: toggle a horizontal or vertical split (toggleterm). Same key + # hides it again. From inside the terminal, drops to normal mode and + # runs the window command, so leaving is one chord (no dance). + { mode = "n"; key = "th"; action = "ToggleTerm direction=horizontal"; options.desc = "Terminal (horizontal)"; } + { mode = "n"; key = "tv"; action = "ToggleTerm direction=vertical size=80"; options.desc = "Terminal (vertical)"; } + { mode = "t"; key = ""; action = ''''; options.desc = "Leave terminal to window"; } + # Cheatsheet: ? pops the full which-key list; sk fuzzy- # searches every active mapping via Telescope (catches non-leader binds too). { mode = "n"; key = "?"; action = "WhichKey"; options.desc = "All keybinds (which-key)"; }