Which vimrc is being used




















For example:. If the gvimrc files exist, they are used to configure Vim when the GUI version gvim runs after settings from vimrc are applied. The most notable being that a gvimrc file is sourced when using the :gui command to change a vim session into a gvim session. Vim can be configured so that, when starting, it reads commands from a vimrc file in the current directory, after reading the primary vimrc. This is configured by adding set exrc to the primary vimrc file. Setting 'exrc' can be a security problem because it means Vim will execute commands from any vimrc file in the directory where Vim is started.

Therefore, you can easily edit these files from within Vim:. After you have saved changes to your vimrc file, you can see the results by exiting from Vim, then starting Vim again. Warning You may need to plan your vimrc so re-sourcing does not cause problems. If you define commands, functions, or autocmds, you must make them remove or override the previous version when sourced, or you will get errors for commands and functions or duplicates for autocmds.

Here are some examples that will work correctly when re-sourced:. Warning You may need to plan your vimrc so re-sourcing does not cause problems. If you define commands, functions, or autocmds, you must make them remove or override the previous version when sourced, or you will get errors for commands and functions or duplicates for autocmds.

Here are some examples that will work correctly when re-sourced:. Some errors in your vimrc may prevent Vim from starting successfully. A reliable way to handle that would be to rename your vimrc file, then edit the renamed file, then give it the correct name. Alternatively, you could start Vim with a command like this or use "gvim" if that is how you run Vim :. The -N starts in "not compatible" mode that is, with extra Vim features. The NONE argument must be uppercase skips initializations and does not read any vimrc file -u , and does not read any gvimrc file -U.

You could now use the :version command to show the vimrc path, then enter a command to edit that file. Proposal Omit suggestions like the following that attempt to auto-source vimrc. I suspect that anyone needing to read a tip to do this could get themselves in quite a bit of trouble. Show 3 more comments.

Active Oldest Votes. Improve this answer. Jay Dorsey Jay Dorsey 1 1 silver badge 6 6 bronze badges. Add a comment. The best way to find out, which files are loaded is to use the command :version You may also have secondary rc files, which are being sourced. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name.

Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming For original articles, please read the permission method in the footer. Tech Community Register Log in. FaceBook Share.

First, let's enter the " : version " command in vim under Linux probably you use the vi command under Linux, but in most Linux, the vi command opens vim , we skip the unrelated content , The display of vimrc is as follows maybe your display is not exactly the same as here : VIM — Vi IMproved 7. When vim starts, it will first try to execute the system's vimrc file usually this file does not exist , then it will find the user vimrc in the above order, and execute the commands in the first user vimrc found, ignoring the remaining user vimrc.

The vimrc file used under Linux is named.



0コメント