I have changed my color scheme in vim by adding this line to .vimrc:

colorscheme desert

When I open .vimrc or .profile the text is colored, but when I do for example vim test.txt the text I enter is not colored. Only the text mode is colored "INSERT/COMMAND".

What is going on?


A .txt file is a plain text file, so it should not be colored. To color text you need a color scheme, and rules on how to color the file (so about syntax).

For .vimrc and .profile, vim can interfere the syntax from the standard file names. Vim can also interfere the syntax with the suffix or the first (or last) line in the file. You can force a syntax with :set syntax=html.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.