I have a doubt about vim,
I installed the editor on my ubuntu 13.10 and everything is ok.
but when I create a file ".txt, or .conf" the highlighting isn't enabled, I put "#" and " but not change color in the file
But when I open a file ".conf" the highlighting is enabled.
the syntax is ON
someone can help me ?
Best Answer
The file ending
.conf
has no syntax set by default. Different configuration files have different syntax, so vim cannot use the same syntax for all.conf
files. To handle this, vim looks at the whole file name and compares it to the patterns found infiletype.vim
(located at/usr/share/vim/vim74/filetype.vim
on my system)For example, say you opened the file
apache.conf
, vim will look infiletype.vim
until it finds something like:which tells vim to use the
apache
syntax highlighting file for any file that begins inapache.conf
. Try creating a new file calledapache.conf
and you should get apache syntax highlighting for that file.Another way vim can set the syntax for a file is with modelines. Modelines let you run vim commands for specific files. They can be found at the top or bottom of files and look something like this:
For more info on modelines checkout
:help modeline
in vim.