Color a file type with VIM

I am using gVim 8.0 for Windows. You can copy log.vim to C:\Program Files (x86)\Vim\vim80\syntax folder. You can add following lines to C:\Program Files (x86)\Vim\vim80\filetype.vim file (usually in alphabetical order listing):

” Log
au BufNewFile,BufRead *.log setf log

———- content of log.vim —————–
” Vim syntax file
” Language: Log file
” Maintainer: Chirag Patel
” Latest Revision: 08 August 2017

if exists(“b:current_syntax”)

:syn keyword logError CRI Error Exception FAILED Failed failed error aborted
:syn keyword logWarning WRN warning Warning Stopped
:syn keyword logInfo INF
:syn keyword logDebug DBG

hi def logError guibg=red guifg=white
hi def logWarning guibg=yellow guifg=black

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.