Color choices in a text editor determine how easily comments, strings, and keywords stand out. Vim groups these choices into a color scheme, which you can switch while editing without changing the file's contents.
Vim includes built-in schemes such as desert, so trying a different palette does not require a plugin. The colors visible in a terminal also depend on that terminal's color support.
An interactive selection lasts for the current Vim session. A colorscheme setting in your personal vimrc loads your preferred palette at startup; a later theme command or plugin can override it.
Steps to change color scheme in Vim:
- Press Esc to return to Normal mode in Vim.
- Apply the built-in desert color scheme.
:colorscheme desert
For other installed schemes, typing :colorscheme with a trailing space followed by Tab completes the scheme name. Repeated Tab presses cycle through matches. An E185 error means Vim cannot find the named scheme.
- Check the active color scheme.
:colorscheme desert
Without an argument, :colorscheme reports the active scheme rather than listing available schemes.
- Open your loaded personal vimrc.
:edit $MYVIMRC
$MYVIMRC points to the personal startup file Vim loaded. If no personal vimrc exists yet, :edit ~/.vimrc creates one on Linux or macOS; Windows uses :edit ~/_vimrc. Vim refuses to switch away from an unsaved buffer, so that buffer needs saving first.
- Add the following lines at the end of your vimrc.
syntax enable colorscheme desert
Existing settings stay above these lines. syntax enable turns on code highlighting, and the final colorscheme command selects the palette. Settings in vimrc have no leading colon.
- Save your vimrc with :wq.
:wq
This writes the file and exits Vim.
- Open a source file in a fresh Vim session.
$ vim example.py
example.py stands for an existing source file you normally edit.
- Confirm that :colorscheme still reports desert.
:colorscheme desert
The source file should retain the chosen palette, with comments, keywords, and strings highlighted. A different reported name indicates that a later startup setting or plugin selected another scheme.