I love vim's colorization of /var/log/messages
, but it only works for that – the absolute filename. It doesn't work for older rotations of messages (e.g. /var/log/messages-20120610
) or for messages files I get from other systems. How can I tweak this?
How to make vim apply /var/log/messages syntax highlighting to any file called “messages” or “messages-*”
syntax highlightingvim
Best Answer
When you have the file open, you can run:
To automate this for all files called messages, put the following into
~/.vim/ftdetect/messages.vim
: