Wednesday, May 30, 2012

auto reload of config files

I'm using the auto reload trick for my .vimrc:

if !exists( "autoload_vimrc" )

let autoload_vimrc = 1
autocmd BufWritePost .vimrc source $MYVIMRC

endif

I'd like to auto reload .vimrc when any of my configuration files are modified.

I tried adding all of the following to the if section above:

autocmd BufWritePost .vim/after/plugin/misc.vim source ~/.vimrc
autocmd BufWritePost .vim/after/plugin/misc.vim source $MYVIMRC
autocmd BufWritePost misc.vim source ~/.vimrc
autocmd BufWritePost misc.vim source $MYVIMRC

None seem to work.

My ~/.vim directory is actually a symlink to ~/projects/dot_vim/.vim, so I don't really want to hardcode the path. However, just to test, I even did that. Still no joy.

Ideally, it would be great to just say if any *.vim file in the .vim directory is modified then reload $MYVIMRC.

Any pointers?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment