Named Workspace Sessions#
Nash has two ways to save a layout. They use different files and different keys.
| Feature | Automatic history (session restore) | Named workspace sessions |
|---|---|---|
| Saved when | Nash exits, a signal arrives, or you ask | You press a key, or autosave runs |
| Covers | Every window | One workspace (session) |
| Files | state/saved-sessions/ (Nash 0.9.4) | nash-sessions/state/nash_state_<workspace>.json |
| Restore with | Restore Saved Session (the dialog) | ALT+l |
| Opens the restore dialog | Yes | No |
Read Session Restore for the automatic history. This page covers the named workspace sessions.
Keys#
The bundled configuration binds these keys. A workspace here is the same thing that Nash calls a session in the multiplexer.
| Key | Action |
|---|---|
ALT+s | Save the current workspace to its own file. |
ALT+l | Choose a workspace, then load all of it or pick one tab. |
ALT+r | Open the restore dialog. |
ALT+f | Fork the current workspace into a new workspace that you name. |
CTRL+SHIFT+d | Delete a saved workspace. |
CTRL+SHIFT+e | Open a saved workspace file in your editor. |
ALT+s does not add to the history that the restore dialog reads. It
writes the named workspace file. To save into the automatic history, run
Save Window Session from the command palette.
Where the files live#
Each workspace has one file, nash_state_<workspace>.json, in the
nash-sessions/state/ directory inside your Nash configuration directory. The
files survive application updates.
CTRL+SHIFT+e opens the file with the program in $EDITOR, or with nvim when
$EDITOR is not set.
Autosave#
Autosave is off until you turn it on with the Toggle Session Autosave command. When it is on, Nash saves the current workspace every 30 seconds and shows a short notification when you turn it on or off.
Since Nash 0.11.1, the command has no default key, and it is not in the
command palette. Earlier versions bound it to ALT+a. An older
~/.config/nash/commands.toml can retain that binding as an explicit override.
Remove the keys field from its toggle_session_autosave entry to inherit the
new default. See Configuration Sync.
To assign a key, override the command in ~/.config/nash/commands.toml:
[[command]] id = "toggle_session_autosave" keys = [{ key = "a", mods = "ALT" }]
The on or off choice survives a configuration reload. It does not survive a restart of Nash, so turn autosave on again after you start Nash.
Git branch warning#
When you save a workspace, Nash records the git branch of each pane's directory.
When you load the workspace, Nash compares the branch with the current one. If a
branch changed, the notification lists each repository with the saved and the
current branch, for example api: main -> feature/login.
What a load restores#
A load recreates the tabs, the splits, and the working directories of the workspace. For each pane whose foreground program is not a shell, Nash types that program into the new pane and presses Enter.
- On Linux, Nash saves the full command line of the program.
- On macOS, Nash saves only the program, without its arguments.
- On Windows, Nash does not start programs again.
Nash treats sh, bash, zsh, fish, nu, cmd.exe, powershell.exe,
pwsh.exe, and wsl.exe as shells and does not type anything for them.