begriffs/haskell-vim-now

.vimrc sourced after saving: perhaps include sourcing when user extensions are saved

Opened this issue · 3 comments

The .vimrc file maintained by the hvn script triggers sourcing of the rc file when saved. Is it possible to have the event trigger include changes to vimrc.local and plugins.vim?

Sorry, can you explain the problem in more detail?

@EdmundsEcho I see what you mean, the augroup here - https://github.com/begriffs/haskell-vim-now/blob/master/.vimrc#L281-L288

It's definitely possible to source the other files as well. Probably just add the filename after $MYVIMRC. Want to try it locally and send a pull request?

Motivated by your feedback I found a way for it to work. If what I propose makes sense (i.e., it's not considered a hack), then the place to make the changes would be to update the documentation for how to create and use vimrc.local.

In my vimrc.local I now include the following:

" Source the vimrc file after saving it
augroup sourcing
  autocmd!
  autocmd bufwritepost vimrc.local source $MYVIMRC
  autocmd bufwritepost vimrc.local source ${HOME}/.config/haskell-vim-now/vimrc.local
augroup END

For some reason, I can't seem to trigger the sourcing of vimrc.local with just the first line. However, when I include these two lines in my vimrc.local, I do not need to change the .vimrc (or the equivalent for nvim) to get both files to be sourced when either file has been changed. A final note, by your design, we should not be changing the .vimrc file so in theory, the only functionality that matters is sourcing when we update vimrc.local. Thus far, the only solution I have is the one proposed. The documentation would include a version for the nvim and vim users (if/then seems conceptually wrong given the user knows which branch it is ahead of time).