From a3cff8895e3ff57f88f6d9b552bee3f2d4018719 Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Mon, 10 Jul 2017 11:11:32 -0400 Subject: [PATCH] Add a vim function for centering the buffer --- vimrc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/vimrc b/vimrc index 3010e05..42a159c 100644 --- a/vimrc +++ b/vimrc @@ -409,11 +409,33 @@ inoremap " LAYOUT """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"//////////////////////////////////////////////////////////////// +" CENTER THE BUFFER +"//////////////////////////////////////////////////////////////// + + function! CenterPane() + " centers the current pane as the middle 2 of 4 imaginary columns + " should be called in a window with a single pane + " Taken from https://dev.to/vinneycavallo/easily-center-content-in-vim + lefta vnew + wincmd w + exec 'vertical resize '. string(&columns * 0.75) + endfunction +nnoremap c :call CenterPane() + +function! RemoveCenterPane() + wincmd w + close +endfunction +nnoremap cw :call RemoveCenterPane() + + "//////////////////////////////////////////////////////////////// " TEXT ALIGNMENT PLUGIN "//////////////////////////////////////////////////////////////// let b:lion_squeeze_spaces = 1 + "//////////////////////////////////////////////////////////////// " STATUS LINE "////////////////////////////////////////////////////////////////