Vim style copy paste in Tmux

“Colorful lines of code on a MacBook screen” by Caspar Rubin on Unsplash
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
bind-key p paste-buffer
set -g default-command "reattach-to-user-namespace -l ${SHELL}"bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
bind-key -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
bind-key p paste-buffer

if-shell 'test "$(uname)" = "Darwin"' 'source ~/.tmux-osx.conf'
set -g default-command "reattach-to-user-namespace -l ${SHELL}"bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'

--

--

Lead Software Engineer at A Cloud Guru

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store