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

Print Friendly, PDF & Email

Leave a Reply

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