How to increase the vertical split window size in Vim

后端 未结 9 1625
抹茶落季
抹茶落季 2020-12-22 15:57

:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once

相关标签:
9条回答
  • 2020-12-22 16:22

    I have these mapped in my .gvimrc to let me hit command-[arrow] to move the height and width of my current window around:

    " resize current buffer by +/- 5 
    nnoremap <D-left> :vertical resize -5<cr>
    nnoremap <D-down> :resize +5<cr>
    nnoremap <D-up> :resize -5<cr>
    nnoremap <D-right> :vertical resize +5<cr>
    

    For MacVim, you have to put them in your .gvimrc (and not your .vimrc) as they'll otherwise get overwritten by the system .gvimrc

    0 讨论(0)
  • 2020-12-22 16:24

    Another tip from my side:

    In order to set the window's width to let's say exactly 80 columns, use

    80 CTRL+W |
    

    In order to set it to maximum width, just omit the preceding number:

    CTRL+W |
    
    0 讨论(0)
  • 2020-12-22 16:25

    This is what I am using as of now:

    nnoremap <silent> <Leader>= :exe "resize " . (winheight(0) * 3/2)<CR>
    nnoremap <silent> <Leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
    nnoremap <silent> <Leader>0 :exe "vertical resize " . (winwidth(0) * 3/2)<CR>
    nnoremap <silent> <Leader>9 :exe "vertical resize " . (winwidth(0) * 2/3)<CR>
    
    0 讨论(0)
提交回复
热议问题