In order to open my vimrc in a split window only if the current buffer isn't really empty, I have the following mappings:
nnoremap ,vu :source <C-R>=vimrc<CR><CR>
nnoremap ,ve :call <sid>OpenVimrc()<cr>
if (0==strlen(bufname('%'))) && (1==line('$')) && (0==strlen(getline('$')))
" edit in place
exe "e ".g:vimrc
exe "sp ".g:vimrc
NB: As my
vimrc isn't named
_vimrc (in order to simplify it's portability to Windows machines), and as it is under a repository managed by the plugin manager I use, I cannot really use
$MYVIMRC. I have another variable computed on-the-fly.
BTW: I don't want it to be automatically loaded whenever I save it. I'd rather be explicit.
For saving I already have a generic
nnoremap <f2> :update<cr>, we don't need anything specific to the vimrc.