melonmanchan / vim-tmux-resizer

Resize tmux panes and vim splits with same shortcuts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTICE: THIS REPOSITORY HAS BEEN ARCHIVED

Please use https://github.com/RyanMillerC/better-vim-tmux-resizer or https://github.com/aserowy/tmux.nvim instead. Thanks!

Vim Tmux Resizer

Resize tmux panes and vim splits with Alt + hjkl! Plays well with vim-tmux-navigator.

Installation

Tmux

Add the following lines to your .tmux.conf file

is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?x?)(diff)?$"'

bind -n M-h if-shell "$is_vim" "send-keys M-h" "resize-pane -L 10"
bind -n M-l if-shell "$is_vim" "send-keys M-l" "resize-pane -R 10"
bind -n M-k if-shell "$is_vim" "send-keys M-k" "resize-pane -U 5"
bind -n M-j if-shell "$is_vim" "send-keys M-j" "resize-pane -D 5"

Configuration

Custom bindings

If you'd prefer to use your own shortcuts instead of the alt keys and Vim movement, add the following to your .vimrc, changing mappings as needed!

let g:tmux_resizer_no_mappings = 1

nnoremap <silent> {Left-mapping} :TmuxResizeLeft<cr>
nnoremap <silent> {Down-Mapping} :TmuxResizeDown<cr>
nnoremap <silent> {Up-Mapping} :TmuxResizeUp<cr>
nnoremap <silent> {Right-Mapping} :TmuxResizeRight<cr>

About

Resize tmux panes and vim splits with same shortcuts


Languages

Language:Vim Script 100.0%