If you really want to do it the hard way, install XCode regardless. Then open up Terminal and run vi, pico, nano (or whatever. those 3 are available that I've seen) your terminal editor of choice is.
There you go, programming in terminal.
Install Fink or MacPorts and you can run emacs, Xemacs, blah blah using X11.
But good grief, just use the XCode tools and to hell with X11 and terminal.