summaryrefslogtreecommitdiff
path: root/tmux
diff options
context:
space:
mode:
authorivan-boikov <ik.boikov.public@protonmail.com>2022-12-14 17:04:27 +0100
committerivan-boikov <ik.boikov.public@protonmail.com>2022-12-14 17:04:27 +0100
commit4047aa8283dce178135c0ff9c3a0a00c33eceecb (patch)
tree6b8bfaa69a05cbdc1cbc99f0850d24511ec04ff6 /tmux
parent92e265fb46019f467ed308cbddc14ac52f312456 (diff)
1
Diffstat (limited to 'tmux')
-rw-r--r--tmux/.config/tmux/tmux.conf68
1 files changed, 45 insertions, 23 deletions
diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf
index 61cdca8..8f687ba 100644
--- a/tmux/.config/tmux/tmux.conf
+++ b/tmux/.config/tmux/tmux.conf
@@ -3,14 +3,53 @@ unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
+# reload config file easily
+bind r source-file "$XDG_CONFIG_HOME/tmux/tmux.conf"
+
# split panes using | and -
-bind \\ split-window -h
-bind - split-window -v
unbind '"'
unbind %
+bind | split-window -h
+bind - split-window -v
-# reload config file easily
-#bind r source-file ~/.tmux.conf
+# DWM-like pane switching with awareness of Vim splits
+# See: https://github.com/christoomey/vim-tmux-navigator
+unbind -n 'C-h'
+unbind -n 'C-j'
+unbind -n 'C-k'
+unbind -n 'C-l'
+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' 'resize-pane -L'
+bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -t :.-'
+bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -t :.+'
+bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'resize-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'"
+
+unbind -n C-Left
+unbind -n C-Right
+unbind -n C-Up
+unbind -n C-Down
+
+bind -n C-Left resize-pane -L
+bind -n C-Right resize-pane -R
+bind -n C-Up select-pane -U
+bind -n C-Down select-pane -D
+
+unbind -T copy-mode-vi 'C-h'
+unbind -T copy-mode-vi 'C-j'
+unbind -T copy-mode-vi 'C-k'
+unbind -T copy-mode-vi 'C-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
# Enable mouse control
set -g mouse on
@@ -25,22 +64,5 @@ set -g status-style "bg=black"
# Vi mode
set-window-option -g mode-keys vi
-# 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
+# quick search on "mod+/"
+bind-key / copy-mode \; send-key ?