vim doesn't reload vimrc with pathogen

Pretty much the title. When I edit my vimrc file and it has the line

call pathogen#infect()


the changes don't take effect until I restart vim. This holds true even if I don't have the bundle folder in ~/.vim, and if this line is at the end or beginning of the vimrc file. I guess this shouldn't be the case, so what's going on?

Edit to clear things:

I'm trying to reload the .vimrc file using :source $MYVIMRC which succeed when I try this without the pathogen line. Edit: some details This is on a freshly installed Linux mint, and the problem appeared on my various attempts to :noremap, and :iabbreviate commands. Commands that change the appearance (e.g. set number seem to work) Edit: some more details Here is an example of something that doesn't work with my .vimrc file :set number! " To indicate that I do reload the file " replacing gamma with \gamma, was here when opened gvim :autocmd FileType tex :iabbrev <buffer> gamma \gamma " replacing lambda with \lambda added after launching gvim :autocmd FileType tex :iabbrev <buffer> lambda \lambda call pathogen#infect()  Adding the lambda file, and then running source ~/.vimrc with a tex file open in the background resulted with no effect when typing lambda. I had to restart gvim. • The vimrc is only loaded once on startup. It is never read again unless you source it manually with :so ~/.vimrc (or something of the sort). Aug 3 '15 at 2:23 • @FDinoff My question wasn't clear. I'm using the source command. Aug 3 '15 at 6:07 • It would be nice to have more details, like which commands aren't executed, or, even better, a description on how to reproduce your problem. Aug 3 '15 at 17:03 • @mMontu, I updated my question. The short answer is Linux mint and almost every commands Aug 3 '15 at 17:21 • If some of your commands (set number) are executed then you cannot say that your vimrc is not being reloaded. My guess is that you are somehow misunderstanding the expected behavior from your map and abbreviation commands (possibly a XY Problem). But it is not possible to know without the details. Aug 3 '15 at 17:45 2 Answers Your immediate problem The right-hand side of an autocommand is executed when the designed event is triggered. In your case, the FileType event is triggered when Vim determines the filetype of a buffer, something that usually happens when a new buffer is created. Because your file is already loaded when you do :source ~/.vimrc, none of your custom autocommands is executed. For them to apply to the current buffer you'll need to force a reload with :edit. The broader problem Adding FileType autocommands to your vimrc is not really a good idea because Vim already does all the work for you! When it decides that the current buffer has a tex FileType, Vim immediately tries to source every tex.vim file it can find in the following directories, in order: 1. ~/.vim/ftplugin/ 2.$VIMRUNTIME/ftplugin/
3. ~/.vim/after/ftplugin/


Since Vim tries to source those files anyway there is no need to add a second (and third, and fourth...) check in your vimrc. One of those files is where you should put your custom settings and mappings.

The first one, ~/.vim/ftplugin/tex.vim, is sourced before the global ftplugin and thus can be overridden. This file is not a safe place for your settings.

Changing the global ftplugin, \$VIMRUNTIME/ftplugin/tex.vim, is a big no-no (won't survive an update, can't be guaranteed to work, may need administrative privilege, etc.).

That leaves us with the last one, ~/.vim/after/ftplugin/tex.vim, the ideal place for your custom tex mappings:

iabbrev <buffer> gamma \gamma
iabbrev <buffer> lambda \lambda

• Would placing my commands in the after file result with update of commands "on the fly"? Would I have to run the source command? Restart Vim? Aug 4 '15 at 6:53
• No, you will need to do force reload your buffer with :e or rerun the filetype detection process with :filetype detect. Aug 4 '15 at 7:08
• then what it the advantage over using augroup? Apart from cluttering the vimrc file that is. Aug 4 '15 at 8:53
• Faster startup, leaner setup. Aug 4 '15 at 9:29

I'm not sure how your problem is related to pathogen, but you should check the following points:

1. If you intend to reload your vimrc them you should use autocmd groups, as explained in :help autocmd-groups. In the current form your FileType event will quickly become cluttered - try reloading your vimrc a few times and then execute :au FileType tex.

2. Notice that you are not directly creating the abbreviations, but creating autocommands that in turn will create abbreviations. Just updating the vimrc isn't enough, it is necessary that the autocommands to be executed in order to update your mappings/abbreviations. You probably doesn't see the update because the Filetype event is usually triggered once for a given buffer. You could check that by including a echom command in the autocommand (by the way, the : on the beginning of various lines on your vimrc is meaningless; if you really likes them you should include it on the call pathogen... to be consistent). You could try to delete the buffer :bd and then open it again, or simply set the filetype again (:set ft=tex).

3. When you intend to change the behavior for a specific filetype you can avoid cluttering your vimrc by creating a file in your after directory, as explained in :h after-directory. For your example, create file ~/.vim/after/ftplugin/tex.vim containing the specific mappings/abbreviations.