aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--%HOME%/.config/tmux/cygwin.conf7
-rw-r--r--%HOME%/.config/tmux/linux.conf19
-rw-r--r--%HOME%/.config/tmux/macos.conf7
-rw-r--r--%HOME%/.tmux.conf43
4 files changed, 37 insertions, 39 deletions
diff --git a/%HOME%/.config/tmux/cygwin.conf b/%HOME%/.config/tmux/cygwin.conf
new file mode 100644
index 0000000..3c9f14a
--- /dev/null
+++ b/%HOME%/.config/tmux/cygwin.conf
@@ -0,0 +1,7 @@
+bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
+bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
+bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard; tmux paste-buffer'
+bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' > /dev/clipboard"
+bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
+bind-key -T root MouseDown2Pane run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
+bind-key ] run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
diff --git a/%HOME%/.config/tmux/linux.conf b/%HOME%/.config/tmux/linux.conf
new file mode 100644
index 0000000..ed4800a
--- /dev/null
+++ b/%HOME%/.config/tmux/linux.conf
@@ -0,0 +1,19 @@
+# Depends on xsel.
+
+# The simple
+#
+# xsel -i --clipboard
+#
+# doesn't work, but
+#
+# xsel -i -p && xsel -o -p | xsel -i -b
+#
+# does[1]. How fun!
+
+bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
+bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
+bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b; tmux paste-buffer'
+bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' | xsel -i -p && xsel -o -p | xsel -i -b"
+bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
+bind-key -T root MouseDown2Pane run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
+bind-key ] run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
diff --git a/%HOME%/.config/tmux/macos.conf b/%HOME%/.config/tmux/macos.conf
new file mode 100644
index 0000000..abbe020
--- /dev/null
+++ b/%HOME%/.config/tmux/macos.conf
@@ -0,0 +1,7 @@
+bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'
+bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
+bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'pbpaste; tmux paste-buff'
+bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' | pbcopy"
+bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'
+bind-key -T root MouseDown2Pane run 'pbpaste | tmux load-buffer - && tmux paste-buffer'
+bind-key ] run 'pbpaste | tmux load-buffer - && tmux paste-buffer'
diff --git a/%HOME%/.tmux.conf b/%HOME%/.tmux.conf
index 21db6d6..c6d0fb6 100644
--- a/%HOME%/.tmux.conf
+++ b/%HOME%/.tmux.conf
@@ -106,45 +106,10 @@ bind-key -T copy-mode-vi v send -X begin-selection
# M-y is y and Y combined.
# ! to copy excluding line endings (most useful for one-line selections).
-# 1. Cygwin
-
-if-shell 'uname | grep -q -F CYGWIN' {
- bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
- bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
- bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard; tmux paste-buffer'
- bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' > /dev/clipboard"
- bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'cat > /dev/clipboard'
- bind-key -T root MouseDown2Pane run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
- bind-key ] run 'cat /dev/clipboard | tmux load-buffer - && tmux paste-buffer'
-}
-
-# 2. Linux
-
-# Depends on xsel.
-# The simple `xsel -i --clipboard` doesn't work, but `xsel -i -p && xsel -o -p
-# | xsel -i -b` [1] does. How fun!
-
-if-shell 'uname | grep -q -F Linux && which xsel' {
- bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
- bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
- bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b; tmux paste-buffer'
- bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' | xsel -i -p && xsel -o -p | xsel -i -b"
- bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xsel -i -p && xsel -o -p | xsel -i -b'
- bind-key -T root MouseDown2Pane run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
- bind-key ] run 'xsel -o | tmux load-buffer - && tmux paste-buffer'
-}
-
-# 3. macOS
-
-if-shell 'uname | grep -q -F Darwin' {
- bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'pbcopy'
- bind-key -T copy-mode-vi Y send-keys -X copy-pipe-and-cancel 'tmux paste-buffer'
- bind-key -T copy-mode-vi M-y send-keys -X copy-pipe-and-cancel 'pbpaste; tmux paste-buff'
- bind-key -T copy-mode-vi '!' send-keys -X copy-pipe-and-cancel "tr -d '\n' | pbcopy"
- bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'pbcopy'
- bind-key -T root MouseDown2Pane run 'pbpaste | tmux load-buffer - && tmux paste-buffer'
- bind-key ] run 'pbpaste | tmux load-buffer - && tmux paste-buffer'
-}
+if-shell 'uname | grep -q -F CYGWIN' source-file ~/.config/tmux/cygwin.conf
+if-shell 'uname | grep -q -F Linux && command -v xsel' \
+ source-file ~/.config/tmux/linux.conf
+if-shell 'uname | grep -q -F Darwin' source-file ~/.config/tmux/macos.conf
# Appearance
# ----------