Skip to content

Instantly share code, notes, and snippets.

@jstaursky
Created May 26, 2023 11:50
Show Gist options
  • Save jstaursky/4b9fb81e485839724ea5c2c4e5552ea2 to your computer and use it in GitHub Desktop.
Save jstaursky/4b9fb81e485839724ea5c2c4e5552ea2 to your computer and use it in GitHub Desktop.
# .tmux.conf
#
# hit C-a as the special tmux prefix then [ for visual mode.
# hit v and use the hjkl keys to select text you want to copy and then hit y to copy the selected text.
# The copied text will be available to the system clipboard.
#
# NOTE for copying to system clipboard xclip must be installed.
#
set -g status off
# Set the prefix to Ctrl+a
set -g prefix C-a
set -s copy-command 'xclip -i'
# Remove the old prefix
unbind C-b
# Send Ctrl+a to applications by pressing it twice
bind C-a send-prefix
# Enable mouse
set -g mouse
# vi mode
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind P paste-buffer
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment