Sunday, March 22, 2009

colorify your logs with vim

we are used to watching logs with "tail -f LOGFILE | ccze -A" command, it was very disturbing for us to look at a log file with any editor, afterwards, without colors. thanks to bekir, he wrote a vim syntax file, and we found peace finally. you can get the syntax file from here, you have to put it in "~/.vim/syntax" folder (if doesn't exist, create), then after opening a log file with vim, if you type ":set syntax=log", your world will be more colorful. if you don't want to say ":set syntax=log" every time, just add "au! BufRead,BufNewFile *log set filetype=log" line to your "~/.vimrc" file. to summarize:

mkdir -p ~/.vim/syntax
cd ~/.vim/syntax
wget --no-check-certificate
echo "au! BufRead,BufNewFile *log set filetype=log" >> ~/.vimrc

No comments: