Wednesday, May 30, 2012

Re: auto reload of config files

On Wednesday, May 30, 2012 2:55:03 AM UTC-6, Benjamin R. Haskell wrote:
> A better way to prevent doubling autocmds is to put them in a group

Good points. It's been switched. Thank you.

> In what way do they not work? To verify that your .vimrc is being
> reloaded, add this to your .vimrc:
>
> echomsg 'Loaded .vimrc'

It seems .vimrc *is* being reloaded. But the settings I'm testing don't appear to be changing.

> Also note that your plugins won't be reloaded just because you source
> your ~/.vimrc. They're autoloaded at startup. (See :help load-plugins
> for the gory details.) From that help text, maybe you also want:

And this is probably part of the reason why they aren't changing ... these aren't plugins, even though I have them in my after/plugins subdirectory, they're just settings and random functions and mappings I use.

I moved these files to after/plugin so I wouldn't have to remember to source them in my .vimrc but it appears now that may not be the best choice.

> autocmd BufWritePost misc.vim runtime! plugins/**/*.vim

After reading the docs on the runtime command I came up with the following for my .vimrc. It seems to work as expected.

runtime! extra/*.vim

aug AutoloadVimrc
au!
au BufWritePost .vimrc source $MYVIMRC
au BufWritePost */extra/*.vim source $MYVIMRC
aug END

Thanks for the 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: