VIM Syntax


elflord@pegasus.rutgers.edu

My Syntax Files

Note that these require the more recent browsers. The error highlighting in particular seems to need Netscape 4.
sh.vim Bugfixes for old sh.vim file note; these fixes have now been applied. This file therefore is only here for historical reasons (-; About sh.vim/bash.vim screenshot (2html) after fix
screenshot (2html) before fix
bash.vim Syntax file for the bash shell About bash.vim screenshot (2html)
spec.vim Syntax for RPM SPEC files About spec.vim screenshot (2html)

How to use these syntax files

The simplest way to use the syntax files is to put them somewhere on your machine, and source them

:so foo.spec
:so bash.spec
when you need to use them. To use the spec syntax file, you can also try this to automate it: put the following in your .vimrc file:

augroup syntax
au! BufNewFile,BufReadPost *.spec  so ~/vim/spec.vim
au  BufNewFile,BufReadPost *.spec  so ~/vim/spec.vim
augroup END

Using the bash.vim syntax file is a little trickier, because you want this to fire up whenever you have a #!/bin/bash in the first line. Here's how it's done (or how I do it anyway).

let X = getline(1)
	let y = match(X, "#!/bin/bash" )
	if (y != -1)
		so ~/vim/bash.vim
	endif
unlet X
unlet y

I also recommend the following: Set your colours up so that "function", "conditional" and "repeat" are distinct from "statement". ( I usually use a black background, and set all three to white. ) By default, this is not enabled for gvim in black backgrounds. However, doing this will make your code more readable for this and for other files since it makes your function definitions and conditional blocks more visible. See my .vimrc file to find out how this is done.

About bash.vim

bash.vim is based on sh.vim , though it contains a few fixes to things that become very problematic when use with bash scripts. I am also playing around with this syntax file. Note that the sh.vim maintainer have been pretty good about including my enhancements in the official sh.vim.

Add ons to sh.vim

See
html rendering of failed test file for a picture of what goes wrong with the existing sh.vim. GO here for the html rendering of the same file using my updated syntax file.

New Features added to bash.vim

To do

spec.vim

I make a lot of RPM packages, and I have found myself somewhat saddened by the nonexistence of a spec.vim file. I tried using sh.vim, but there are a lot of problems doing this. Hence I have started out on a spec.vim file.

spec.vim TODO list