Skip to content

Instantly share code, notes, and snippets.

@dbb
Created August 18, 2011 19:44
Show Gist options
  • Save dbb/1154978 to your computer and use it in GitHub Desktop.
Save dbb/1154978 to your computer and use it in GitHub Desktop.
function ReloadConfigs()
:source ~/.vimrc
if has("gui_running")
:source ~/.gvimrc
endif
endfunction
command! Recfg call ReloadConfigs()
" error: function already exists, add ! to replace it
function! ReloadConfigs()
:source ~/.vimrc
if has("gui_running")
:source ~/.gvimrc
endif
endfunction
command! Recfg call ReloadConfigs()
" error: cannot replace function, it is in use
@telemachus
Copy link

I don't off the top of my head, but it reminded me of this that I ran into a few months ago: http://dailyvim.blogspot.com/2008/11/reload-vimrc.html

@dbb
Copy link
Author

dbb commented Aug 18, 2011

The problem is that I have to source % then source ~/.gvimrc when I'm working in gvim.

@dbb
Copy link
Author

dbb commented Aug 18, 2011

I opened a SO thread about it: http://stackoverflow.com/questions/7114744/function-to-source-vimrc-and-gvimrc

It seems like using the if has("gui_running") approach might be the simplest solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment