[courses] [c] lesson 11: enumerating boolean/hacking vim

Morgon Kanter admin at surgo.net
Wed Nov 13 19:56:09 EST 2002

First, I found the vim startup scripts directory (for debian it was 
/usr/share/vim). open up syntax/c.vim in your favorite editor, and do search 
for int. After about the 7th search for int, you'll see a line that says:
syn keyword	cType		int long short char void
add boolean after void

What we just did was change vim's startup script to find the syntax 
highlighting for a file that ends in ".c"

Anyway, to make use of this, we do a boolean enum:
enum boolean {false, true};
#define boolean enum boolean

This will look a slight bit messy under our new syntax highlighting (it would 
without it anyway, though), but what we have now is a boolean data type with 
2 possible values, false(0) and true(1). the #define was for you can declare 
a boolean without the preceding enum, like:
boolean x;
/* instead of */
enum boolean x;

Fetch my public key from http://www.surgo.net/pubkey.asc

More information about the Courses mailing list