Where is the configuration file?
When using vim, you need to know a series of configuration files. The location of these configuration files depends on the installation location of vim and the operating system you are using.
Generally, there are three configuration files that you must know where to find.
Vimrc
This is the most important configuration file of VIM. It has two versions: Global and personal )).
The global vimrc file is placed in the directory where you install Vim. You can open vim and enter the following command in normal mode to find the location of the directory.
: Echo $ Vim
The result is as follows:
Linux:/usr/share/Vim/vimrc
Windows: C:/program files/Vim/vimrc
Your vimrc file is stored in your home directory. the location of the main directory depends on your operating system. vim was originally provided for UNIX and Unix-like operating systems. Therefore, in the user version, vimrc files are all set to hide files by adding a dot at the beginning of the file name. this method is used to hide files on Unix-like systems, but does not apply to Microsoft Windows. therefore, the vimrc file is related to the operating system. it should be like this:
Linux:/home/Kim/. vimrc
Windows: C:/Documents and Settings/Kim/_ vimrc
No matter how you change the vimrc file of the user version, the setting content is covered in the content set in the global vimrc file. This means that you do not need to change the global vimrc file to configure vim.
In Vim normal mode, you can enter the following command to find the location of the main directory of your system that Vim considers:
: Echo $ home
The vimrc file contains the ex (predecessor of VI) command, a command line. The vimrc file is also the default method for adding Vim configuration information.
Your vimrc can use other files (including configuration information) as external resources. In the vimrc file, you can use the source command to implement:
Source/path/to/external/File
This will keep your vimrc files clean and tidy, and your settings will be more structured (for more information about how to keep the vimrc file clean, see appendix B ).
Gvimrc
The gvimrc file is a configuration file designed for gvim. It is similar to the above mentioned vimrc file and is placed in the same directory (also divided into the user version and global version), such:
Linux:/home/Kim/. gvimrc
/Usr/share/Vim/gvimrc
Windows: C:/Documents and Settings/Kim/_ gvimrc
C:/program files/Vim/
This file is used to set GUI settings that can only be used by gvim.
Exrc
This file is used for backward compatibility with VI or ex. it is also in the same directory as the vimrc file, which is also divided into the user version and global version ). however, unless you want to use Vim In the Vi-compatible mode, you will not use this file.