Custom syntax with vim

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

: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



detached process on centos

If you want to run an application from ssh even if you exit ssh session, do the following:

# nohup <application with arguments > &

This will put the process in background and will detach from terminal as well.

Also, edit /etc/rc.local and add above line to execute application from startup.

This works fine with CentOS 6.


Asterisk on Debian 4.0

– Check Linux kernel version
# uname -a
Linux ElectronWork 2.6.24-etchnhalf.1-686 #1 SMP Fri Dec 26 04:10:16 UTC 2008 i686 GNU/Linux

– Check Debian version
# cat /etc/debian_version

– Install various pre-requisite libraries.
# apt-get install make
# apt-get install gcc
# apt-get install g++
# apt-get install libc-dev
# apt-get install bison
# apt-get install ncurses-dev
# apt-get install libssl-dev
# apt-get install libnewt-dev
# apt-get install zlib1g-dev
# apt-get install initrd-tools
# apt-get install cvs
# apt-get install procps
# apt-get install doxygen

– Get Asterisk package.
# wget http://downloads.digium.com/pub/asterisk/releases/asterisk-
# tar xvzf asterisk-
# cd asterisk-

– Install Asterisk
# ./configure
If you see asterisk symbol in the end, configuration is successful. Else, grep for “no” in config.log and try to install those missing libraries/utilities.
# make
takes ~11min
# make install
# make samples (optional)
# make progdocs (optional)

– Test your installation.
# asterisk -r


System language for Debian Linux

System language for Debian Linux – Chirag Patel December 30, 2008

I ran into a simple but typical issue.

I was installing Debian 4 (kernel 2.6) today using minimal boot image CD and out of curiocity I selected its installation language to Gujarati. All screens showed almost 90% of the content in Gujarati (incorrectly translated at many places though). I select “English -US” as my choice of language for system locales. But, after installation and reboot, all the user screens had weird characters on screen (I was expecting English). I kept looking for a way to change locales and did this:

– I opened root terminal.
– Entered following command:
chirag@work~# dpkg-reconfigure locales
– I selected “en-US-utf-8” from the list shown.
– After OKing this and rebooting the system, I found characters known to me!


PCI standard requirements

PCI standard requirements – compiled by Chirag Patel December 27, 2008

Payment Card Industry (PCI) requirements of Data Security Standard (DSS) include following basic compliances:

– Install and maintain firewall configuration to protect card holder data.
– Do not use vendor supplied defaults for system passwords and other secuirity parameters.
– Protect stored cardholder data.
– Encrypt transmission of cardholder data across open, public networks.
– Use and regularly update anti-virus software.
– Develop and maintain secure systems and applications.
– Restrict access to cardholder data by business need-to-know.
– Assign a unique ID to each person with computer access.
– Restrict physical access to cardholder data.
– Track and monitor all access to network resources and cardholder data.
– Regularly test security systems and processes.
– Maintain a policy that addresses information security.

(Ref: WEBSITE magazine November, 2008)


Folding with VIM

Folding with VIM – Chirag Patel Dec 14, 2008

— Edit “~/.vimrc”

— Add following options
set fmr={,}
set fdm=indent

— To use syntax folding for a file, enter following command after opening it.
:set fdm=syntax

— To set no folding, edit “~/.vimrc”
set nofoldenable

— By default all available folds are folded. Change that to preferred max in “~/.vimrc”.
set fdn=1

1 is good value as it will close all top level folds to be closed (e.g. functions), but not any blocks inside.

— Some commands while in command in command mode:
zo ==> open fold under cursor
zO ==> open folds recursively under cursor
zc ==> close fold under cursor
zC ==> close folds recursively under cursor
zA ==> toggle folds recursively
zM ==> close all folds in a file
zR ==> open all folds in a file


My VIM configuration

Vim Basic Configuration – Chirag Patel Dec 14, 2008

— Edit “~/.vimrc” file and add following tags per need

set autoindent ==> auto-indent code
set incsearch ==> start searching as we type word for search
set hlsearch ==> highlight all occurrences for search
set nowrap ==> disable line wrapping
set ts=4 ==> set tabsize to 4 space size
set softtabstop=4 ==> tabbing match my tabsize of 4
set shiftwidth=4 ==> shifting match my tabsize of 4
set noexpandtab ==> do not replace tab with spaces
set showmatch ==> highlight matching bracket/braces as we move cursor
set mat=5 ==> matching for search
set nocompatible ==> no vi compatibility
filetype on ==> vim detects file type
syntax on ==> highlight syntax words for file type
set ruler
set cindent ==> “C” indent rules for auto-indent
==> following command restores file position while re-opening
autocmd BufReadPost *
\ if expand(“:p:h”) !=? $TEMP |
\ if line(“‘\””) > 0 && line(“‘\””) following command postpones using “zv” until after reading the modelines
autocmd BufWinEnter *
\ if exists(“b:doopenfold”) |
\ unlet b:doopenfold |
\ exe “normal zv” |
\ endif