Introduction to the jmacs Text Editor

Once you've logged into your linux ssh account, you'll need to use a text editor to write your code. There are a few already installed on the system (vi, emacs, etc.), but these have a bit of a learning curve associated with them. An editor that's relatively easy to learn to use is called jmacs. However, this editor is entirely operated from the keyboard, you can't use the mouse, which means you'll have to learn some simple keyboard commands. Fortunately they're pretty quick and easy to learn!

NOTE: Any command prefixed with a caret symbol (^) means to use the Ctrl key (e.g., ^x means to press the Ctrl+x keys at the same time).

Assuming that you've logged into your linux account and are at the shell's command line prompt (see below), issue the command to start editing with jmacs. The example below shows that, if you wish, you may also provide the name of the file you want to edit:

After pressing the Enter key, the jmacs editor appears (see below).

Notice the following elements in the picture above:

If you type ^x,^h it will bring up the help menu (it also makes it disappear!). This menu shows you a table of keystrokes you can use in your editing session:

So try it out NOW!

Make the help menu appear by typing ^x,^h, then make it disappear with the same keystroke. Do this several times so you feel comfortable making the help menu appear and disappear, because it will no doubt be extremely useful when you're editing your code!

Next, experiment with some of the commands you see in the help menu. For example, type some text into your file, then make the cursor move around -- go to the left (Ctrl+b), then to the right (Ctrl+f), then up (Ctrl+p), then down (Ctrl+n). Some other commands you'll no doubt find very useful:

And perhaps one of the most helpful keystrokes to know is that one that will cancel the current command: Ctrl+g, so if you need to stop whatever command you're in the middle of, you can use that! So take some time to explore the help menu, it will probably save you a great deal of time down the road.

(By the way, there are several help menus available; look at the very first row of the window above and it indicates that you can use ^x. (that's Ctrl+x, followed by the period character) to cycle through the help menus.)

Okay, assuming that you're in the text editor, you can type in the code for your program, as you see in the image below. (NOTE: the #include statement is in dark blue, it's kind of difficult to see it with a black background, but it's there!)

Once you've entered all your code, you can save your file with the ^x,^s command, and then quit the text editor with the ^x,^c command. You should then find yourself back at the shell's command line prompt, from where you can compile and run your program!

Of course, after that, all that's left to do is compile your code and then see if it works:
     g++ foo.cpp

Well, that ought to be enough to get you started. Naturally, the more you practice with jmacs, the better you'll get at using it, which will make writing code much easier!