Patel406210322-004

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”)
finish
endif

: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

Patel406210322-004

Custom syntax with vim Chirag Patel August 10, 2015

Custom syntax with vim Chirag Patel August 10, 2015

On Linux, install vim if you do not have.
On Windows, install gVim (I tried 7.4).

Create vjn.vim file similar to following example.

Vim syntax file
Language: config file
Maintainer: Chirag Patel

if exists(b:current_syntax)
finish
endif

:syn keyword error ERROR
:syn keyword warn WARNING

:syn keyword user chirag vrund svara parul
:syn keyword admin digant vikas hina

hi def error guibg=red guifg=white
hi def warn guibg=yellow guifg=black

hi def user guifg=tomato1
hi def admin guifg=deep pink

Check vim74/rgb.txt file to find color definitions.
Add vjn.vim to vim74/syntax folder.
Edit vim74/filetype.vim file and add following lines to alphabetical order of file types.

Config
au BufNewFile,BufRead *.vjn setf vjn

You are all set to have fun and have interesting configuration file looks.

Also, do not forget to add following to your vim settings (_vimrc or .vimrc) for more fun.

colorscheme slate
set guifont=Courier_New:h10:cANSI
set autoindent
set ts=4
set softtabstop=4
set shiftwidth=4
set incsearch
set hlsearch
set nowrap
set noexpandtab
set showmatch
filetype on
syntax on
set ruler
set cindent
set noswapfile
set mat=5