tmux usage - deeper
# Vim keys in copy mode setw -g mode-keys vi # Enable mouse set -g mouse on # Enter copy mode with PageUp bind -n PageUp copy-mode -u
If you're a Vim user, absolutely yes, I would recommend:
or in ~/.tmux.conf:
Difference: emacs vs vi
This setting only affects copy mode, command prompts, and some text editing in tmux. It does not change your shell (bash/zsh) behavior.
mode-keys emacs (default)
Navigation resembles Emacs:
| Action | Key |
|---|---|
| Up | Ctrl+p |
| Down | Ctrl+n |
| Left | Ctrl+b |
| Right | Ctrl+f |
| Beginning of line | Ctrl+a |
| End of line | Ctrl+e |
| Exit copy mode | q / Esc |
For Vim users, these shortcuts often feel unnatural.
mode-keys vi
Navigation resembles Vim:
| Action | Key |
|---|---|
| Up | k |
| Down | j |
| Left | h |
| Right | l |
| Page down | Ctrl+f |
| Page up | Ctrl+b |
| Top | g |
| Bottom | G |
| Search forward | / |
| Search backward | ? |
| Next match | n |
| Previous match | N |
| Exit copy mode | q |
This makes tmux scrollback feel very similar to reading a file in Vim.
Enable permanently
Edit:
Add:
Reload without restarting tmux:
Verify:
Output:
Even better Vim setup
Many Vim users also add mouse scrolling and easier copy-mode entry:
Useful vi-mode copy shortcuts
After entering copy mode:
Common operations:
Visual selection (Vi style)
Or in newer tmux versions:
with these bindings:
This gives a very Vim-like experience inside tmux. For developers who spend a lot of time in Vim/Neovim + tmux + SSH, mode-keys vi is generally the preferred configuration.
posted on 2026-09-26 20:55 ENGINEER-F 阅读(2) 评论(0) 收藏 举报
浙公网安备 33010602011771号