tmux-like resize for vim
any package manager should do. i use vim-plug.
call plug#begin()
Plug 'thekelvinliu/tsize'
call plug#end()
this plugin uses g:tsize_amount
as the resize increment.
it defaults to 3.
the plugin can be invoked either via ex command or plug mapping.
the standard vim directions -- h
, j
, k
, l
-- correspond to direction of resize.
" ex commands
:TSIZEH
:TSIZEJ
:TSIZEK
:TSIZEL
" plug mappings
nmap <silent> <left> <plug>(tsize_h)
nmap <silent> <down> <plug>(tsize_j)
nmap <silent> <up> <plug>(tsize_k)
nmap <silent> <right> <plug>(tsize_l)
key bindings in tmux can be repeatedly invoked without having to re-press the prefix key. it's possible to get a similar behavior in vim without plugins too:
" recursively invoke <c-space> after resize to allow repeat
nmap <silent> <c-space>h <plug>(tsize_h)<c-space>
nmap <silent> <c-space>j <plug>(tsize_j)<c-space>
nmap <silent> <c-space>k <plug>(tsize_k)<c-space>
nmap <silent> <c-space>l <plug>(tsize_l)<c-space>
use this if you want to resize vim windows like you do tmux panes. inspired by vim-arrows, which is based on this stack overflow answer.