It seems like there's some odd caching-like behavior going on for files that I have already opened once in Vim. I have a file foo.txt that I opened, and then I change some of the settings in ~/.vim/after/ftplugin/text.vim, but those new settings do not appear in foo.txt. I can quit vim and reopen foo.txt, or reload with :e, or even :so ~/.vim/after/ftplugin/text.vim, but none of these seem to have an effect on foo.txt's settings. If I mv foo.txt bar.txt, the settings show up for bar.txt with no issues.
EDIT
It seems I can force the settings to reload for foo.txt with the following sequence:
:so ~/.vimrc:so ~/.vim/after/ftplugin/text.vim
Questions:
- Why is this necessary / why were the other settings not picked up?
- Why was sourcing
~/.vimrcnot enough? It applied settings that were directly specified in~/.vimrc, but shouldn't the ftplugins have been loaded at the linefiletype plugin indent on? Why was sourcingtext.vimafterwards necessary?
A few more precisions:
.vimrcis loaded once -> for defining global stuff.gvimrc, loaded only with gvim after the.vimrcmacros/scripts (loaded explicitly/manually)As you see, all things are loaded once, only. If you want to load them several times, you'll have to do it manually and explicitly. That's why a few of us have a
:Reloadcommand that simplifies reloading any kind of script - mine is hidden in my collection of scripts: lh-misc -> plugin/vim-maintain.vim