Keys and Commands
SUPER is the Command key on macOS. Nash ships the commands below in the
commands.toml file of your configuration directory, ~/.config/nash/.
Defaults
| Command title | Command id | Action | Default keys |
|---|---|---|---|
| Grow Pane | grow_pane | GrowPane | SUPER+E, SUPER+M |
| Shrink Pane | shrink_pane | ShrinkPane | SUPER+SHIFT+E, SUPER+SHIFT+M |
| Toggle Pane Fold | toggle_pane_fold | TogglePaneFoldState | none |
| Unfold Pane | unfold_pane | UnfoldPaneOrPassthrough | Enter |
| Toggle Pane Zoom | toggle_pane_zoom | TogglePaneZoomState | none |
| Minimize Window | minimize_window | Hide | none |
Grow Pane, Shrink Pane, Toggle Pane Fold, Toggle Pane Zoom, and Minimize Window
appear in the command palette (SUPER+SHIFT+P or CTRL+SHIFT+P) and in the
Window menu where your platform has one.
What the actions do
| Action | Behavior |
|---|---|
GrowPane | One step up the size ladder: unfolds a folded pane, maximizes a normal pane, restores a maximized pane. |
ShrinkPane | One step down: restores a maximized pane, folds a normal pane, and does nothing for a folded pane. |
TogglePaneFoldState | Folds the active pane, or unfolds it if it is folded. |
SetPaneFoldState(true) | Folds the active pane if it is not folded. You can bind it in keys.lua. |
SetPaneFoldState(false) | Unfolds the active pane if it is folded. You can bind it in keys.lua. |
UnfoldPaneOrPassthrough | Unfolds the active pane if it is folded. Otherwise it hands the key to the pane's program, as if nothing were bound. |
TogglePaneZoomState | Maximizes the active pane, or restores the layout. |
UnfoldPaneOrPassthrough is why Enter can unfold a strip and still run your
command lines. The binding does nothing unless the active pane is folded. A key
table that binds Enter wins over it, so Enter keeps its normal meaning in
copy mode. Opening an overlay such as search or copy mode unfolds the pane under
it first.
Change a key
Edit ~/.config/nash/commands.toml. Each command is a [[command]] entry, and
keys is a list of { key, mods } pairs.
Give Toggle Pane Fold a key:
[[command]] id = "toggle_pane_fold" title = "Toggle Pane Fold" # ... the rest of the entry stays as it is ... keys = [{ key = "f", mods = "CTRL|ALT" }] action = "TogglePaneFoldState"
Keep only one pair of ladder keys by removing the other pair:
[[command]] id = "grow_pane" # ... keys = [{ key = "e", mods = "SUPER" }] action = "GrowPane"
Bind Minimize Window, which has no default key because SUPER+M and
SUPER+SHIFT+M belong to the ladder:
[[command]] id = "minimize_window" # ... keys = [{ key = "m", mods = "SUPER|CTRL" }]
Choose keys that no other command uses. If a key does not do what you expect,
search commands.toml for another entry with the same key.
Take Enter off the unfold command
Comment out the keys line of the unfold_pane entry:
[[command]] id = "unfold_pane" # ... # keys = [{ key = "Enter", mods = "NONE" }] action = "UnfoldPaneOrPassthrough"
A key you commented out stays off. Configuration sync leaves it alone when you upgrade Nash.
Use keys.lua
You can also bind actions from Lua. Nash reads ~/.config/nash/keys.lua. The
file returns a list of key bindings:
local nash = require 'nash' return { { key = 'f', mods = 'CTRL|ALT', action = nash.action.SetPaneFoldState(true) }, { key = 'u', mods = 'CTRL|ALT', action = nash.action.SetPaneFoldState(false) }, }
After an upgrade
Nash 0.7.3 and newer merge new commands into commands.toml on the first launch
after an update. On Nash 0.7.0 to 0.7.2, or if the keys above are missing from
your file, run:
nash config sync --all --dry-run nash config sync --all
The first command shows what Nash would add. The second adds it, and keeps a
.bak copy of every file it changes. See
Configuration Sync.