After my Vim keymappings cheatsheet, here are my current settings for Tmux. Again, I published several blog posts related to my Tmux settings in the past.
Initially I defined a second prefix key, and then I decided that C-b
is perfectly good for me, and I rather add a new “hot key” in the name of “Meta” (Alt
). Ubuntu relies on the Super key for its mappings, while the Ctrl key is used by Vim, Irssi, and many other of my CLI software. The Alt
key is pretty handy for me, it reminds of my Emacs time and it does not interfere with other environment that I know or use regularly (beside folks using both the Ctrl and Alt key in some Vim plugins).
Compared to Neovim, my requirements are even more minimalistic since I don’t use any extra plugins or frameworks. In what follows, I only show what I added to my .tmux.conf
file.
Mapping | Command | Role |
M-H | resize-pane -L 4 | resize pane toward left |
M-J | resize-pane -D 4 | resize pane toward bottom |
M-K | resize-pane -U 4 | resize pane toward up |
M-L | resize-pane -R 4 | resize pane toward right |
M-! | split-window -f -l 10 -c "#{pane_current_path}" | bottom popup terminal |
M-- | display-popup -E -w 80% -h 80% "lf" | lf file manager in a popup |
M-: | command-prompt | display command prompt |
M-< | swap-pane -U | move pane to the left |
M-> | swap-pane -D | move pane to the right |
M-Enter | new-window | new window |
M-= | choose-buffer | select among paste buffers |
M-Down | swap-window -t +1 | move window to the right |
M-Up | swap-window -t -1 | move window to the left |
M-Left | previous-window | select next window to the left |
M-Right | next-window | select next window to the right |
M-k | previous-window | select next window to the left |
M-j | next-window | select next window to the right |
M-O | switch-client -l | change current Tmux client and session |
M-n | command-prompt -p "New Session:" "new-session -A -s '%%'" | create new session |
M-X | "kill-session -a" | kill all other sessions |
M-x | kill-session | kill current sessions |
M-h | choose-window 'join-pane -h -s "%%"' | attach pane to another window |
M-V | select-layout even-horizontal | arrange panes using horizontal layout |
M-S | select-layout even-vertical | arrange panes using vertical layout |
M-l | last-window | go to last window |
M-m | command-prompt -p "Search man pages for:" "new-window 'exec man %%'" | query man page in a temporary window |
M-o | selectp -t :.+ | go to other split |
M-p | run-shell -b ~/bin/tmux-fzf | select picker for window |
M-s | split-window -v -c "#{pane_current_path}" | create horizontal split |
M-v | split-window -v -c "#{pane_current_path}" | create vertical split |
M-t | break-pane | convert pane to proper window |
M-w | choose-window | show list of sessions and windows |
M-y | copy-mode | activate copy mode |
M-z | resize-pane -Z | maximize current pane |
C-b C-g | setw synchronize-panes | synchronize panes |
C-b C-m | if -F '#{s/off//:mouse}' 'set -g mouse off; display-message "mouse: off"' 'set -g mouse on; display-message "mouse: on"' | toggle mouse mode on/off |
C-b C-p | run "tmux capture-pane; tmux save-buffer ~/tmp/tmux-\"$(date +%FT%T)\"" | save buffer to a file |
C-b C-r | source-file ~/.tmux.conf \; display-message "Config reloaded" | reload Tmux config |
C-b C-s | if -F '#{s/off//:status}' 'set status off' 'set status on' | toggle status bar on/off |
For copy-pasting, I have the following settings:
bind Y copy-mode
setw -g mode-keys vi
bind-key -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle
set -g set-clipboard off
bind-key -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -i -selection clipboard"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -selection clipboard"