Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

Common Way of Resizing Windows/Panes in Vim and Tmux

$
0
0
Vim

So in Vim I use the default bindings for resizing buffers. But I’ve tweaked them a bit :smirk:. The only thing I’ve done is to rebind the keys in whatever mode, so just noremap , to increase and decrease by 5 instead of the default 1.

noremap <C-w>+ :resize +5<CR> noremap <C-w>- :resize -5<CR> noremap <C-w>< :vertical:resize -5<CR> noremap <C-w>> :vertical:resize +5<CR>

More info in Vim help system at :h window-resize .

Tmux

In Tmux I bind the same keys used in Vim (now with Tmux prefix obviously, I use Ctrl+A like most others). Here I change the value by 10 instead of 5. Only reason for this is that it feels right. I think the system are in columns and rows or something, but that doesn’t really matter.

bind-key -r ‘+’ resize-pane -U 10 bind-key -r ‘-’ resize-pane -D 10 bind-key -r ‘<’ resize-pane -L 10 bind-key -r ‘>’ resize-pane -R 10

The -r flag passed into the binding makes it repeatable. So when you press your prefix, you have a certain time to hammer > for example to make the pane increase to the right. The time you got depends on your repeat-time option which defaults to 500 milliseconds.

Thanks for reading :raised_hands::wave:


Viewing all articles
Browse latest Browse all 11063

Trending Articles