aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/tmux/tmux.conf133
1 files changed, 92 insertions, 41 deletions
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
index d52ab08..e487f2d 100644
--- a/.config/tmux/tmux.conf
+++ b/.config/tmux/tmux.conf
@@ -20,13 +20,13 @@ bind C-s send-prefix
bind-key -n C-a send-prefix
# Disable local tmux keys (nested tmux)
-bind -T root C-S-s \
+bind -T root F12 \
set prefix None \;\
set key-table off \;\
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
-bind -T off C-S-s \
+bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
refresh-client -S
@@ -120,46 +120,97 @@ bind -n M-0 select-window -t :=0
#――――――――――――――――――――――――――――――――――――――――――
+# navigate across tmux-vim
+is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
+ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
-### Pane Movement/Control ###
-
-# 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|l?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'"
-
-# Copy Mode vi-directional keys
-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
-
-# Change horizontal split <Prefix>% and Vertical split <Prefix>" to <Prefix>h and <Prefix>v respectively and change current working directory
-bind v split-window -h -c "#{pane_current_path}"
-bind h split-window -v -c "#{pane_current_path}"
-
-# Pane resizing, <Prefix> then shift + vi-directional keys, default is D,U,L,R
-bind -r H resize-pane -L 20
-bind -r J resize-pane -D 20
-bind -r K resize-pane -U 20
-bind -r L resize-pane -R 20
-
-# Pane resizing, <Prefix> then alt + vi-directional keys
-bind-key M-j resize-pane -D 5
-bind-key M-k resize-pane -U 5
-bind-key M-h resize-pane -L 5
-bind-key M-l resize-pane -R 5
+bind -Troot C-w if-shell "$is_vim" "send-keys C-w" "switch-client -Tnav; refresh-client -S"
+
+bind -Tnav C-w send-keys 'C-w'
+
+# {{{ keybinds: select-pane
+bind -Tnav h select-pane -L
+bind h select-pane -L
+bind -Tnav C-h select-pane -L
+bind C-h select-pane -L
+bind -Tnav j select-pane -D
+bind j select-pane -D
+bind -Tnav C-j select-pane -D
+bind C-j select-pane -D
+bind -Tnav k select-pane -U
+bind k select-pane -U
+bind -Tnav C-k select-pane -U
+bind C-k select-pane -U
+bind -Tnav l select-pane -R
+bind l select-pane -R
+bind -Tnav C-l select-pane -R
+bind C-l select-pane -R
+bind -Tnav p select-pane -l
+bind p select-pane -l
+bind -Tnav C-p select-pane -l
+bind C-p select-pane -l
+# keybinds: select-pane }}}
+
+# {{{ keybinds: split-window
+bind -Tnav "\\" split-window -h -c "#{pane_current_path}" # vertical
+bind "\\" split-window -h -c "#{pane_current_path}" # vertical
+bind -Tnav "|" split-window -fh -c "#{pane_current_path}" # full vertical
+bind "|" split-window -fh -c "#{pane_current_path}" # full vertical
+bind -Tnav "-" split-window -v -c "#{pane_current_path}" # horizontal
+bind "-" split-window -v -c "#{pane_current_path}" # horizontal
+bind -Tnav "_" split-window -fv -c "#{pane_current_path}" # full horizontal
+bind "_" split-window -fv -c "#{pane_current_path}" # full horizontal
+# keybinds: split-window }}}
+
+# {{{ keybinds: resize-pane
+bind -r -Tnav M-h resize-pane -L 10
+bind -r M-h resize-pane -L 10
+bind -r -Tnav M-j resize-pane -D 5
+bind -r M-j resize-pane -D 5
+bind -r -Tnav M-k resize-pane -U 5
+bind -r M-k resize-pane -U 5
+bind -r -Tnav M-l resize-pane -R 10
+bind -r M-l resize-pane -R 10
+# keybinds: resize-pane }}}
+#### Pane Movement/Control ###
+#
+## 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|l?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'"
+#
+## Copy Mode vi-directional keys
+#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
+#
+## Change horizontal split <Prefix>% and Vertical split <Prefix>" to <Prefix>h and <Prefix>v respectively and change current working directory
+#bind v split-window -h -c "#{pane_current_path}"
+#bind h split-window -v -c "#{pane_current_path}"
+#
+## Pane resizing, <Prefix> then shift + vi-directional keys, default is D,U,L,R
+#bind -r H resize-pane -L 20
+#bind -r J resize-pane -D 20
+#bind -r K resize-pane -U 20
+#bind -r L resize-pane -R 20
+#
+## Pane resizing, <Prefix> then alt + vi-directional keys
+#bind-key M-j resize-pane -D 5
+#bind-key M-k resize-pane -U 5
+#bind-key M-h resize-pane -L 5
+#bind-key M-l resize-pane -R 5
# Hide a pane and bring it back with <Prefix>! and <Prefix>@ respectively
bind-key ! break-pane -d -n _hidden_pane