I'm going to have to disagree with starting with Xcode for your first program. It's like using a high-powered laser cannon to open a can. Someday when you need to open a 20-story can, you might start considering the laser, but for your first program I would stick to a can opener.
A vi(m) cheatsheet can be be found here:
http://www2.cs.uidaho.edu/~rinker/ed03.pdf
To run vim you'll need to open terminal in OS X. from there, you can start with:
vi helloworld.c
This will open vi with a new document called helloworld.c. Open a second terminal window with ctrl+n.
In the vim window, enter (i)nsert mode with the i key. Then type:
Code:
#include <stdio.h>
int main(int argc,char *argv[]) {
printf("Hello World!\n");
}
Once you've entered this text, press esc to exit insert mode. Then type :w<enter>. This will (w)rite the changes you've made.
In your second terminal window, enter:
gcc -o helloworld helloworld.c
./helloworld
The commands in vim will be confusing at first. However, knowing how to use this editor, if you will ever work on another unix-like system, will be invaluable. For starters what's in this post, plus :q to quit are all you'll need. You can then move on to deleting characters, words, etc. Eventually working up to replacement, undo and redo, etc.