Tmux
Neovim setup
I currently use the LazyVim distribution for Neovim, which relies on persistence.nvim for session management.
Session management
- Session files are stored in
~/.local/state/nvim/sessions. - If sessions become corrupt, you can safely delete these files.
How to install plugins from a dotfiles repo?
Tmux plugins are usually cloned from their Git repositories rather than stored as a local folder like a fork such as nordic-tmux.
The usual approach is to keep the plugin repos in the configured tmux plugin directory and load them through your tmux plugin manager.
How to source .zshrc easily in tmux?
If you need to reload your .zshrc while using tmux:
- Press
Prefix + rto reload your session. - Press
Alt + bspaceto remove any broken sessions. - Start a new tmux session from the terminal. This will automatically source
.zshrc, similar to opening a fresh terminal window. - Both
tmux-resurrectandpersistence.nvimwill restore your environment.
Tmux keybindings and workflow
In tmux, I use Prefix (Alt + w) as the mod4-style key. When activated, it enables tmux commands and changes the top-left terminal icon background to indicate the mode is active.
bind -n creates a keybinding without requiring the prefix, which is useful for actions such as opening a new tab with Alt + Enter.
Tabs and navigation
Alt + Enter– create a new tabAlt + a– focus on the left windowAlt + d– focus on the right windowAlt + q– kill the current pane or tabPrefix + o– rename the current tab
Session commands
Prefix + Ctrl + r– restore a saved sessionPrefix + Shift + Q– detach and keep the session runningCtrl + w (Prefix) + r– find a session withfzfCtrl + w (Prefix) + Shift + R– reload the tmux configPrefix + Ctrl + s– save the current session
If you kill a tab, save the session to avoid losing your workspace. This ensures the session can be restored later, such as after a reboot.
Plugin management
Prefix + I– install new plugins from GitHub or another Git repo and refresh the tmux environmentPrefix + U– update installed pluginsAlt + u– remove or uninstall plugins that are not in the active plugin list
Neovim notes
I currently use the LazyVim distribution on Neovim, which uses persistence.nvim.
- Session files are saved in
~/.local/state/nvim/sessions. - You can delete them if they become corrupted.
How to source .zshrc easily?
If you need to source .zshrc in tmux, press Prefix + r, then use Alt + bspace to clear broken sessions. After that, start tmux from the terminal; tmux-resurrect and persistence.nvim will restore your previous session and source .zshrc automatically.
Knowledge
Prefix (Ctrl + w)acts like a mod4 key. When pressed, it enables tmux shortcuts.q– detach and keep the session runningr– find a session withfzfR– reload the tmux configt– create a new taba– focus the left windowCtrl + s– save the sessionCtrl + r– restore the sessiond– focus the right windowQ– kill the pane or tab- If you kill a tab, save the session first if you want to preserve it for the next
tmuxsession.
- If you kill a tab, save the session first if you want to preserve it for the next
o– rename the windowI– install new plugins from GitHub or another Git repo and refresh the tmux environmentU– update pluginsAlt + u– remove or uninstall plugins not on the plugin list