Skip to content

ph3nac/simple-vim-tmux-window-navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple vim tmux window navigation

This plugin is a simplified version of vim-tmux-navigator

Usage

add the following to your ~/.tmux.conf file:

is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"

# if you use fig use this is_vim

# is_vim="children=(); i=0; pids=( $(ps -o pid=,tty= | grep -iE '#{s|/dev/||:pane_tty}' | awk '\{print $1\}') ); \
# while read -r c p; do [[ -n c && c -ne p && p -ne 0 ]] && children[p]+=\" $\{c\}\"; done <<< \"$(ps -Ao pid=,ppid=)\"; \
# while (( $\{#pids[@]\} > i )); do pid=$\{pids[i++]\}; pids+=( $\{children[pid]-\} ); done; \
# ps -o state=,comm= -p \"$\{pids[@]\}\" | 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 -t:.-'
bind-key -n 'C-l 'if-shell "$is_vim" 'send-keys C-l' 'select-pane -t:.+'

# bind-key -T copy-mode-vi 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -t:.-'
# bind-key -T copy-mode-vi 'C-l 'if-shell "$is_vim" 'send-keys C-l' 'select-pane -t:.+'

Keybind

key vim tmux
ctrl+h ctrl+W :.-
ctrl+l ctrl+w :.+

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published