Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tmux: improve copy/paste with X

  • Loading branch information...
commit 1f4fce8214e6dfa2f01c56bfcf7619eb8ca19045 1 parent 77af190
@majutsushi authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 tmux/tmux.conf
View
9 tmux/tmux.conf
@@ -89,10 +89,11 @@ bind-key -r C-k resize-pane -U 1
bind-key -r C-l resize-pane -R 1
bind-key -t vi-copy Escape cancel
-#Copy tmux paste buffer to CLIPBOARD
-bind-key C-y run "tmux show-buffer | xclip -i -selection clipboard"
-#Copy CLIPBOARD to tmux paste buffer and paste tmux paste buffer
-bind-key C-p run "tmux set-buffer -- \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
+# Copy tmux paste buffer to CLIPBOARD
+# Use save-buffer instead of show-buffer to avoid inserting spurious linebreaks
+bind-key C-y run-shell "tmux save-buffer - | xclip -i -selection clipboard"
+# Copy CLIPBOARD to tmux paste buffer and paste tmux paste buffer
+bind-key C-p run-shell "xclip -o -selection clipboard | tmux load-buffer -; tmux paste-buffer"
# The following helps with Shift-PageUp/Shift-PageDown
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
Please sign in to comment.
Something went wrong with that request. Please try again.