Skip to content

Instantly share code, notes, and snippets.

@zfz
Last active August 31, 2023 20:31
Show Gist options
  • Select an option

  • Save zfz/3bd4b59d526437a8e13f to your computer and use it in GitHub Desktop.

Select an option

Save zfz/3bd4b59d526437a8e13f to your computer and use it in GitHub Desktop.
setw -g mode-keys vi
# Switch panels
bind k selectp -U # switch to panel Up
bind j selectp -D # switch to panel Down
bind h selectp -L # switch to panel Left
bind l selectp -R # switch to panel Right
# History limit
set-option -g history-limit 10000
# Display 256color for Vim
set -g default-terminal "screen-256color"
# Vi copy: https://dev.to/iggredible/the-easy-way-to-copy-text-in-tmux-319g
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"
bind P paste-buffer
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"
# Steps to copy and paste
# - Add setw -g mode-keys vi in your tmux config
# - Ctrl + [ to enter tmux vi copy mode
# - Move around with vim navigation keys
# - Begin highlight with Space
# - Copy with Enter
# - Paste with Ctrl + ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment