Wiki

Vim Cobra Support

Single User

Change to your home directory

cd $HOME

Get the most recent updates from the Mercurial repository via a clone

hg clone http://bitbucket.org/ramonrocha/cobra-on-vim/ cobra-vim

For *.zip, *.gz, and *.bz2 archives download the file from  http://bitbucket.org/ramonrocha/cobra-on-vim/

Create a .vim directory if one isn't already present

mkdir .vim

Then copy the four folders (colors, indent, ftdetect, syntax) from cobra-vim into the .vim directory:

cp -r cobra-vim/* .vim

Open or create a file with a .cobra extension and you will have highlighting and indentation for Cobra

If you use a dark background, you can try the cobra color scheme. Execute the following command while in Vim.

:colorscheme cobra

If you use a light background, you can try the cobralight color scheme instead.

:colorscheme cobralight

Add either of the previous commands to your .vimrc file in your home directory to make the change permanent.

To change back to the default color scheme, execute:

:colorscheme default

If the color schemes don't seem to be working then your terminal may not support all necessary colors. Check the value of your TERM variable by executing

echo $TERM

at the command prompt. If it reports xterm then you can try the following to enable color support.

export TERM=xterm-256color

If the colors show up correctly now you can add that line to your .bashrc file. This was tested on Ubuntu 12.04 LTS and 10.04 LTS.

All Users

For all users use your system admin privileges to copy the indent/cobra.vim, ftdetect/cobra.vim, syntax/cobra.vim, into Vim's indent, ftdetect, and syntax directories, respectively. These directories are found in the Vim home path. An example of such a Vim path is /usr/share/vim/vim72.

Alternative

Per Eric Z. Beard:

Vim set to python works Ok in a pinch.

au BufNewFile,BufEnter *.cobra set noexpandtab ts=4 sw=4 filetype=python