Where Are .vimrc and vimrc Files?

Vim is a popular command-line text editor that provides a lot of advanced features. These features can be configured in different ways from the Vim interface or command line or configuration files named .vimrc and vimrc .

Vim Configuration Files

Vim basically provides 2 configuration files. The first configuration file is named .vimrc and used for the current user specifically. The second configuration file is named vimrc and applied for all users in the system.

Global (System-wide) Vim Configuration File – vimrc

The global or system-wide vim configuration file is generally located under the /etc/vim/vimrc . This configuration file is applied to all users and when Vim is started this configuration file is read and Vim is configured according to this file contents. This configuration file contains some basic configurations like enabling syntax highlighting on background color etc by default.

Global (System-wide) Vim Configuration File – vimrc

User Vim Configuration File – .vimrc

The second configuration file is named .vimrc and located under every user home directory like ~/.vimrc . This configuration is applied for the current user only and other users are not affected. This configuration file is also applied after the global configuration file is applied in order to preserve and apply user-specific configuration different from the system-wide configuration. In some cases, this configuration file may not be created by default. You can create the ~/.vimrc file like below.

$ touch ~/.vimrc

Alternatively, following path specifications can be used for .vimrc configuration file in Linux.

$HOME/.vimrc
~/.vimrc
/home/ismail/.vimrc

Vim is a cross-platform tool that can be also installed on other operating systems like Windows. If you are using the Windows operating system the .vimrc is located under the user’s home directory with the name of _vimrc .

$HOME/_vimrc

Leave a Comment