On Fri, Jan 17, 2020 at 2:10 PM DwigtArmyOfChampions <[email protected]> wrote: > > I am using Vim 7.4. I have a file /etc/vimrc, but when I vim a file and run > the :scriptnames command, the very first file loaded is ~/.vimrc. > > On another Linux machine I also have Vim 7.4 installed, and when run the vim > command and then run :scriptnames, that loads /etc/vimrc. > > Where is this loading order determined?
The first file sourced at startup is the "system vimrc" — if it exists. Its default name is $VIM/vimrc (with no initial period to the filename) but the path can be modified at compile time; on most versions of Vim distributed as part of Linux distributions the system vimrc, if it exists, is at /etc/vimrc. Its path for a given Vim executable can be found near the middle of the output of the :version command. If you have different Vim executables on the same machine, looking for their system vimrc scripts at different places, and you want them to use the same script (for all users — all login names — on that system) you can put at one of these locations a symlink to the other one. The recommended procedure is to use one ~/.vimrc (see below) per user; if a single person can login under more than one username it is possible to maintain one .vimrc and set symlinks for the other usernames'. If there is no "vimrc" file where Vim looks for the system vimrc, that is no error, and Vim just goes on to the next startup step, which is looking in several places for your user vimrc. Again, not finding it is no error, and if it is not found, modern versions of Vim (starting at Vim 8.0) source $VIMRUNTIME/defaults.vim, unless they have been specifically ordered not to load it, e.g. by having -u NONE on the command-line. For details, see ":help startup" and in particular its steps b (:help system-vimrc) and c (:help .vimrc). BTW, Vim 7.4 is getting a little long in the teeth: the current version as of this writing is 8.2.124. Best regards, Tony. -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXt%3D_MoCc4VsE%3D3psVQSva7CouzrPcBofO2L%3De-AhgzxOQ%40mail.gmail.com.
