aboutsummaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorjakobst1n <jakob.stendahl@outlook.com>2022-03-01 13:44:09 +0100
committerjakobst1n <jakob.stendahl@outlook.com>2022-03-01 13:44:09 +0100
commit8c8ea3760651c226e585a67b3800e676a2cc86c0 (patch)
tree0fd2c24d2f1187fdfb9249f7c6b95f74b360ff7a /linux
parent661605170322a3f7eff49f733fa2e0b25038ef22 (diff)
downloaddotfiles-8c8ea3760651c226e585a67b3800e676a2cc86c0.tar.gz
dotfiles-8c8ea3760651c226e585a67b3800e676a2cc86c0.zip
Update a few things
Diffstat (limited to 'linux')
-rw-r--r--linux/tmux.conf37
1 files changed, 33 insertions, 4 deletions
diff --git a/linux/tmux.conf b/linux/tmux.conf
index 4977e70..131fc47 100644
--- a/linux/tmux.conf
+++ b/linux/tmux.conf
@@ -43,11 +43,17 @@ bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
+# Set copying settings
+setw -g mode-keys vi
+set-option -s set-clipboard off
bind P paste-buffer
-bind-key -Tcopy-mode-vi 'v' send -X begin-selection
-bind-key -Tcopy-mode-vi 'y' send -X copy-selection
-bind-key -Tcopy-mode-vi 'r' send -X rectangle-toggle
-bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'`
+bind-key -T copy-mode-vi 'v' send -X begin-selection
+bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
+bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -sel clip -i'`
+unbind -T copy-mode-vi Enter
+bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
+#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -ind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'xclip -se c -i'
+#bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'xclip -se c -i''
bind-key S-Left swap-window -t -1
bind-key S-Right swap-window -t +1
@@ -62,6 +68,29 @@ set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g mouse on
#set-option -s set-clipboard off
+# -- macros --------------------------------------------------------------------
+bind-key a send-keys \"jakob.stendahl\ <jakob.stendahl@infomedia.dk>\"
+
+# -- vim-tmux-navigator --------------------------------------------------------
+# Smart pane switching with awareness of Vim splits.
+# See: https://github.com/christoomey/vim-tmux-navigator
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
+ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
+bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
+bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
+bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
+bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
+tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
+if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
+if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
+ "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
+
+bind-key -T copy-mode-vi 'C-h' select-pane -L
+bind-key -T copy-mode-vi 'C-j' select-pane -D
+bind-key -T copy-mode-vi 'C-k' select-pane -U
+bind-key -T copy-mode-vi 'C-l' select-pane -R
+bind-key -T copy-mode-vi 'C-\' select-pane -l