dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 522da0e4a51fa7156f5d20a563a38dc669c5fbaa
parent a912cec7f4bf4dd88852ede95604ac05152bc24b
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date:   Wed,  9 Mar 2016 12:47:16 -0800

improve multi-os clipboard functionality

Diffstat:
M.tmux.conf | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/.tmux.conf b/.tmux.conf @@ -15,10 +15,18 @@ set -g history-limit 10000 unbind [ bind Escape copy-mode unbind p -bind p paste-buffer +#bind p paste-buffer bind-key -t vi-copy 'v' begin-selection #bind-key -t vi-copy 'y' copy-selection -bind-key -t vi-copy y copy-pipe "if [ `uname | grep -q Darwin` ]; then reattach-to-user-namespace pbcopy; else xclip -i -sel clipboard; fi" + +# Copy +if-shell 'uname | grep -qi Linux && which xclip > /dev/null' 'bind-key -t vi-copy y copy-pipe "DISPLAY=:0 xclip -i -sel clipboard"' +if-shell 'uname | grep -qi Darwin && which reattach-to-user-namespace > /dev/null' 'bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"' + +# Paste +if-shell 'uname | grep -qi Linux && which xclip > /dev/null' 'bind p run "DISPLAY=:0 xclip -o | tmux load-buffer - ; tmux paste-buffer"' +if-shell 'uname | grep -qi Darwin && which reattach-to-user-namespace > /dev/null' 'bind p run "reattach-to-user-namespace pbpaste | tmux load-buffer - ; tmux paste-buffer"' + # vi-like movement #bind-key k select-pane -U @@ -163,9 +171,5 @@ set -g message-fg yellow set -g message-bg black set -g message-attr bright -# Linux clipboard -bind C-c run "tmux save-buffer - | xclip -i -sel clipboard" -bind C-v run "tmux set-buffer \"$(DISPLAY=:0 xclip -o -sel clipboard)\"; tmux paste-buffer" - # use urlview to follow URLs bind-key u capture-pane \; save-buffer /tmp/active_tmux_buffer \; new-window -n urlview '$SHELL -c "urlview < /tmp/active_tmux_buffer && rm /tmp/active_tmux_buffer"'