Configuration of Kamailio syntax for VIM

Created on 2010-11-02 by Yannick Vaucher

 

 

Introduction

 

Kamailio is already difficult enough to be understood. So that's why customizing a bit our tools can be useful.

In this how-to, we will add the syntax color for kamailio script and make it colored on start.

 

Few steps are needed to have a comfortable installation.

And two files are required. One is for syntax detection and the second one is for coloring rules.

 

Enable the auto-detection of syntax

 

Let's start by improving a bit our VI editor so it starts with few functionality enabled.

 

Edit the vi startup configuration file.

vi ~/.vimrc

 

Write the following line in it

filetype plugin on

 

Apply the changes

:wq

 

 

You can also add in vimrc, some lines such as : syntax on

 

That will enable automatically color syntax instead of have to write the command each time you open VI again.

 

Or as : colorsheme elflord

 

This last command, will allow you to define the set of color used by default when using syntax color.

 

So those commands will be launched on start of vim as well

 

Add the file of auto-detection

 

Check if current user you are willing to use vi got a ~/.vim/ftdetect folder.

 

If it doesn't, create that folder.

 

mkdir ~/.vim

mkdir ~/.vim/ftdetect

 

Get the file for Kamailio script detection

 

cd ~/.vim/ftdetect

wget http://www.asipto.com/pub/sr-vim-syntax/3.0/ftdetect/ser.vim

 

 

Here is a local copy of the file :

 

Description

Syntax detection File for kamailio

File

data1/ftdetect/ser.vim

Size

546 bytes

 

Add the file for syntax colors

 

Find the VIM folder

 

Open your VI editor.

vi

 

Search for your runtime directory with this command while being in VI

:!echo $VIMRUNTIME

 

Copy the result and go to this folder for example :

cd /usr/share/vim/vim71

 

Open syntax folder

 

cd syntax

 

Get the syntax file to save it locally in the syntax folder

 

wget http://www.asipto.com/pub/sr-vim-syntax/3.0/syntax/ser.vim

Local copy of the file :

Description

Syntax coloring rules

File

data1/syntax/ser.vim

Size

6.34 KB