Skip to content

Commit

Permalink
add(tmux): copy support for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
ajr-dev authored and nicknisi committed Dec 19, 2020
1 parent 3c568a5 commit dc09b2f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Brewfile
Expand Up @@ -58,6 +58,8 @@ if OS.mac?
mas "ColorSlurp", id: 1287239339
mas "Bear", id: 1091189122
mas "1Blocker", id: 1107421413
elsif OS.linux?
brew "xclip"
end

tap "homebrew/bundle"
Expand Down Expand Up @@ -96,4 +98,3 @@ brew "wdiff"
brew "wget"
brew "z"
brew "zsh"

19 changes: 13 additions & 6 deletions tmux/tmux.conf.symlink
Expand Up @@ -83,12 +83,19 @@ unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind -Tcopy-mode-vi 'v' send -X begin-selection
bind -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "tmux save-buffer - | reattach-to-user-namespace pbcopy"

# Buffers to/from Mac clipboard, yay tmux book from pragprog
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
bind -T copy-mode-vi v send -X begin-selection

if-shell "uname | grep -q Darwin" {
bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'tmux save-buffer - | pbcopy'; \
bind C-c run 'tmux save-buffer - | pbcopy'; \
bind C-v run 'tmux set-buffer "$(pbpaste)"; tmux paste-buffer'
}

if-shell '[[ $(uname -s) = Linux ]]' {
bind -T copy-mode-vi y send -X copy-pipe-and-cancel 'xclip -i -sel clipboard'; \
bind C-c run "tmux save-buffer - | xclip -i -sel clipboard"; \
bind C-v run 'tmux set-buffer "$(xclip -o -sel clipboard)"; tmux paste-buffer'
}

##############################
### Color & Style Settings ###
Expand Down

0 comments on commit dc09b2f

Please sign in to comment.