I know how to turn syntax highlighting on and off in vim by running this in the editor:
:syntax on/off
But I want syntax highlighting to be enabled by default, so I don’t have to turn it on every time I run vim.
How do I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit your
$HOME/.vimrc(Unix/Linux/OSX) or$HOME/_vimrc(Windows) to include the following line:EDIT
If your syntax highlighting doesn’t work when you start Vim, you probably don’t have a
$HOME/.vimrcor$HOME/_vimrc(known collectively asvimrcfrom now on). In that case, you have two options:vimrc.vimrc_example.vimas yourvimrc(recommended, thanks @oyenamit). You can findvimrc_example.vimin the runtime directory.The location of the runtime directory varies between operating systems:
/usr/share/vim/vim73.\Program Files\Vim\vim73.