Vertical VIM change in a certain direction

I'm trying to reassign the usual vim shortcut Ctrl-W + <and Ctrl-W +> to resize the current active panel to the specified direction ("<" for the left and ">" on the right), but, unfortunately, I could not find the command , which does this, is only a command that increases / decreases the size of the panel by the specified amount, which is not what I need.

this is currently what i have:

nnoremap <Cw>> :vertical res +5<CR> nnoremap <Cw>< :vertical res -5<CR> 

But this increases the current window size by 5 columns, regardless of whether I am on the right panel or on the left panel, which is not very intuitive.

Is there a command that resizes the current window left or right (similar to Tmux for performing these actions)?

+4
source share
1 answer

You can set it based on the window number:

 au! WinEnter * call SetWinAdjust() fun! SetWinAdjust() if winnr() > 1 nnoremap <Cw>> <Cw>< nnoremap <Cw>< <Cw>> else nnoremap <Cw>> <Cw>> nnoremap <Cw>< <Cw>< endif endfun 
+1
source

All Articles