Vim no color - disable colors in text editor

Whenever I open a shell script in vim, it shows colors and syntax highlighting. How dp I turn off all colors in vim text editor running on CentOS Linux system?

That is easy task open vim:


Type (press Esc + :)

syntax off

How to disable colors i…e turn off all colors in vim?

Edit a file named .vimrc in your home directory with the following command:

vim $HOME/.vimrc

Append the following

syntax off
set nohlsearch
set t_Co=0

Save and close the file. You won’t see any color when you open the script in vim:


You can enable or disable colors by simply typing the following command in vim or in ~/.vimr (vim config file):

Turn it on

syntax on

Turn it off

syntax off


Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki