aboutsummaryrefslogtreecommitdiff
path: root/.config/tmux
diff options
context:
space:
mode:
authorsrdusr <trevorgray@srdusr.com>2024-01-23 23:49:50 +0200
committersrdusr <trevorgray@srdusr.com>2024-01-23 23:49:50 +0200
commit95474204ba48f8c713b03df9fc3406a2175d3328 (patch)
tree0e96fe424a9bf579bfa259c54cb74e6ab6068652 /.config/tmux
parent18ab65591ce3085ba7dea7e9cc03eb23a5299865 (diff)
downloaddotfiles-95474204ba48f8c713b03df9fc3406a2175d3328.tar.gz
dotfiles-95474204ba48f8c713b03df9fc3406a2175d3328.zip
C-a is now conditional "(n)vim" and allow mouse wheel scroll
Diffstat (limited to '.config/tmux')
-rw-r--r--.config/tmux/tmux.conf24
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
index 8275422..2afb8a0 100644
--- a/.config/tmux/tmux.conf
+++ b/.config/tmux/tmux.conf
@@ -18,6 +18,8 @@ bind C-s send-prefix
# Send the prefix to client inside window (nested tmux)
#bind-key -n C-a send-prefix
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
+bind -n C-a if-shell "$is_vim" "send-keys C-a" "send-prefix"
# Disable local tmux keys (nested tmux)
bind -T root F12 \
@@ -45,6 +47,9 @@ bind -r L send-keys 'C-l'
bind R rename-window '' \; \
command-prompt -I "#W" "rename-window -- '%%'"
+# Renumber all windows when one is killed
+set -g renumber-windows on
+
# Mouse
set -g mouse on
#set -g mouse-select-pane on
@@ -57,6 +62,25 @@ set -g mouse on
# Sane scrolling
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
+# Sane scrolling
+set -g terminal-overrides 'xterm*:smcup@:rmcup@'
+bind -n WheelUpPane {
+ if -F '#{==:#{window_name},nvim}' {
+ #send-keys -M
+ send-keys Up
+ } {
+ copy-mode -e
+ }
+}
+bind -n WheelDownPane {
+ if -F '#{==:#{window_name},nvim}' {
+ #send-keys -M
+ send-keys Down
+ } {
+ copy-mode -e
+ }
+}
+
# Shift up/down copy-mode without prefix
bind-key -n S-Up copy-mode \; send-key Up
bind-key -n S-Down copy-mode \; send-key Down