I want to resize horizontal splits in vim. I have a vim script solution for vertical splits. I have checked online but no one talks about how to resize horizontal splits. I have a couple of failed attempts. both the vimscript solution for vertical splits and my failed attempts are below.
script to resize vertical splits
" resize splits
noremap <silent> <C-S-Right> :vertical resize -1<CR>
noremap <silent> <C-S-Left> :vertical resize 1<CR>
failed attempt to resize horizontally splits
noremap <silent> <C-S-Up> :split resize 1<CR>
noremap <silent> <C-S-Down> :split resize -1<CR>
CodePudding user response:
noremap <silent> <C-S-Up> :resize 1<CR>
noremap <silent> <C-S-Down> :resize -1<CR>
CodePudding user response:
You could also reuse the built-in mappings:
noremap <silent> <c-s-right> <c-w><
noremap <silent> <c-s-left> <c-w>>
noremap <silent> <c-s-up> <c-w>
noremap <silent> <c-s-down> <c-w>-
Beware that the left/right commands move the right border of the current window, while the up/down commands move the bottom border. Your bindings have inverted these directions, which makes me think you have a different expectation.