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 in filetype.vim
(located at /usr/share/vim/vim74/filetype.vim
on my system)
For example, say you opened the file apache.conf
, vim will look in filetype.vim
until it finds something like:
au BufNewFile,BufRead apache.conf*,apache2.conf* setfiletype apache
which tells vim to use the apache
syntax highlighting file for any file that begins in apache.conf
. Try creating a new file called apache.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:
# vim: syntax=apache
For more info on modelines checkout :help modeline
in vim.
.txt
is a plaintext file. And so is a.conf
. What makes you think that there's supposed to be highlighting on those?.conf
syntax, because it differs by program a lot of times. If you open in GEdit, or anything else which has syntax highlighting, unless there's a line at the beginning saying#!/bin/something
or something which defines the syntax language, they usually don't highlight on.conf
files. I just tested by doingvim znc.conf
on my ZNC config file, andvim nginx.conf
on my nginx conf file and there's 0 syntax highlighting, maybe you have a line at the beginning of the specific conf files that dictates the language/syntax to highlight with?