

To enable the syntax highlight feature you also need to include the following line: syntax on Here, you can set the default color scheme by modifying the colorscheme line and setting the theme you prefer. To make the changes permanent, modify Vim’s configuration file with the wanted color settings.įirst, you need to open the Vim startup file, located in /etc or users home directory under the name. Once you close Vim, the color scheme returns to the default settings. Take a look at this file and its initial color scheme when opened with the Vim text editor:Ĭhanges you have made to the color settings are not permanent. The best way to show how the highlight command works, is with a simple example. Instead, the values you use for these highlight keys include: bold, italic, underline, reverse, and none. However, cterm and gui are not used with color values. When specifying the values for ctermfg, ctermbg/ guifg, guibg, you can use standard color names, their prescribed numbers or hex values (only in the GUI). Users who prefer the GUI need to use the highlight keys: The key=value element varies depending on whether you use a GUI or work in a terminal window.įor example, if you are working inside a terminal that has color support, you could include any of the following highlight keys: To see an extensive list of all the groups, refer to Vim’s official documentation. These are just some out of the many Vim highlight groups.

It's a good idea to map your Caps Lock key to Esc, as it's closer and nobody really uses the Caps Lock key. To return to NORMAL mode after changing to a different mode, press Esc.

You begin in NORMAL mode, which is where you will spend most of your time once you become familiar with vim. Vim has different modes, unlike most editors you have probably used. You can open multiple files by passing multiple file arguments. You can pass a filename as an option and it will open that file, e.g. You simply type vim into the terminal to open it and start a new file.
