Last active
October 19, 2017 03:19
-
-
Save vcavallo/c3147fca261c78bd9c4a3648089b22e8 to your computer and use it in GitHub Desktop.
vimscript function to center a lone pane in the window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" centers the current pane as the middle 2 of 4 imaginary columns | |
" should be called in a window with a single pane | |
function CenterPane() | |
lefta vnew | |
wincmd w | |
exec 'vertical resize '. string(&columns * 0.75) | |
endfunction | |
" optionally map it to a key: | |
" nnoremap <leader>c :call CenterPane()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
further explanation here: http://vcavallo.github.io/blog/2017/02/28/vim-function-to-visually-center-a-plaintext-file/