Create a gist now

Instantly share code, notes, and snippets.

vimscript function to center a lone pane in the window
" 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