How to Configure Vim

by Kristen Waters

Vim is an enhanced version of the Vi text editor. Like Vi, It is accessed from the command line and can be used to edit any text file, including system configuration files. It also allows you to use Unix commands from inside the editor. Vim has some functions, such as incremental searching and the ability to show text in color, that Vi doesn't have. You can configure Vim with different options to suit your needs by specifying them in the .vrmc file.


Create an empty .vmrc file in your home directory. touch ~/.vmrc

Open the .vmrc file for editing. vim ~/.vmrc

Enter the options that you want to use by default into the file. Anything that you can customize by using the :set command can be added to this file. An example configuration would be set incsearch set showmode set tabstop=5 set ignorecase set smartcase The first line says to use Vim's incremental search, which will show you each match as you type when you are searching for a pattern. The second line says to show the current input mode. The third sets the tabstop to 5 spaces. The fourth option says to ignore the distinction between upper- and lowercase letters when searching for a pattern. The fifth option changes the ignorecase option to mean only ignore the distinction if you type the pattern in lowercase. If you type the pattern with uppercase, it will search for the exact pattern. For example, if you type "/pat," it will match Pat, pAt, and PAT. If you type "/Pat," it will only match Pat.

Save the .vmrc file with the command: :wq

Open the Vim editor to ensure that all your configurations have been implemented.

Items you will need


About the Author

Kristen Waters has been writing for the computer industry since 2004. She has written training materials for both large and small computer companies as well as how-to and informative articles for many online publications. She holds Bachelor of Science degrees from both York College of Pennsylvania and the University of Maryland.

More Articles