mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
update pane and window switching
This commit is contained in:
35
tmux.conf
35
tmux.conf
@@ -16,33 +16,16 @@ unbind C-b
|
|||||||
set -g prefix C-a
|
set -g prefix C-a
|
||||||
bind C-a send-prefix
|
bind C-a send-prefix
|
||||||
|
|
||||||
#
|
# window switching
|
||||||
# Smart pane switching with awareness of Vim splits.
|
bind -n C-h select-window -t:-
|
||||||
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
bind -n C-l select-window -t:+
|
||||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
|
|
||||||
|
|
||||||
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
|
# smart pane switching with awareness of vim splits
|
||||||
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
|
bind -nr C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
|
||||||
|
bind -nr C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
|
||||||
bind -n C-h run "($is_vim && tmux send-keys C-h) || \
|
bind -nr C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
|
||||||
tmux select-pane -L"
|
bind -nr C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
|
||||||
|
bind -nr C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
|
||||||
bind -n C-j run "($is_vim && tmux send-keys C-j) || \
|
|
||||||
($is_fzf && tmux send-keys C-j) || \
|
|
||||||
tmux select-pane -D"
|
|
||||||
|
|
||||||
bind -n C-k run "($is_vim && tmux send-keys C-k) || \
|
|
||||||
($is_fzf && tmux send-keys C-k) || \
|
|
||||||
tmux select-pane -U"
|
|
||||||
|
|
||||||
bind -n C-l run "($is_vim && tmux send-keys C-l) || \
|
|
||||||
tmux select-pane -R"
|
|
||||||
|
|
||||||
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
|
|
||||||
|
|
||||||
# Setup 'v' to begin selection as in Vim
|
|
||||||
bind-key -t vi-copy v begin-selection
|
|
||||||
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
|
|
||||||
|
|
||||||
# splitting panes
|
# splitting panes
|
||||||
bind | split-window -h
|
bind | split-window -h
|
||||||
|
|||||||
Reference in New Issue
Block a user