tags:

views:

310

answers:

1

Does anybody know how to edit a syntax file for VIM so that keywords are capitalized automatically? I need to do this to keep my coding style consistent with the rest of the developers in my team.

I'm using VIm version 7.2 (actually gVIM) and the syntax file I'm using is the Progress.vim file (installed automatically with VIM under the Syntax directory). I have made a couple tweaks to the file as I didn't like how some things were done, but it is mostly the same.

TIA

+7  A: 

Try:

:help abbreviations

For example:

:iab begin BEGIN

Now whenever you type "begin", it will be replaced by "BEGIN".

Greg Hewgill
Will I need to do this for every keyword, or is there some sort of way to do this for anything classified as a ProgressReserved (i.e. syn keyword ProgressReserved, which would be a list of reserved keywords for the Progress language)?
Jason Down
I don't think there's a way to automatically do this for a set of keywords. The abbreviation functionality is a generic text replacement facility. It should be easy enough to write a script to generate a vim source file with all your keywords which you can read in with :source.
Greg Hewgill
Ok I'll try something along these lines and see how it goes. Thanks Greg.
Jason Down
you should be able to find that list of keywords in the syntax file in $VIMRUNTIME/syntax/progress.vim so you can copy paste from there.
rampion
What do you guys think about using a dictionary file and using CTRL-P (just read about how this can be done)?
Jason Down