Useful “hnb” Keyboard Commands

After you've thought a lot about the program you're going to write, you'll eventually be ready to begin the design phase. Here you should break down the problem into a collection of functions. For any singular task that you can identify for your program, it's probably a candidate to be a function!

However, identifying useful functions doesn't lead directly to code! You need to figure out what a function is going to do before you write it, and the more algorithmic details you can come up with for a particular function, the easier it will be to translate the algorithm into code.

An excellent method for accomplishing this is to write a functional specification. This is an outline document that has entries for every function you're thinking of writing. Each entry will describe:

There are many tools out there to create outlines, but we have one installed on the ssh server called "hnb". You can use this program to create the functional specification for your programming project; initially there will be a slight learning curve, as the program is a bit "old-fashioned" in its interface, but it's also an extremely simple program and with a little practice you'll find it pretty easy to write your document.

To start the program and see tutorial, just type "hnb" at the command line prompt, you'll find yourself in the hnb editor with some initial outline entries. Go ahead and read the subtree entries under the "Using Outlines" entry at the top (all you need to do is use the arrow keys to navigate through the outline; left/right arrow keys will expand and collapse entries, and up/down arrow keys will allow you to move vertically through the tree).

After you've played around with the tutorial sample, you should try creating a document of your own. To do this, just type hnb followed by the name of the file you want to create. hnb saves its outlines in it's own file format, so you give your files a .hnb extension, like this: hnb myfunspec.hnb, this will create the file myfunspec.hnb that will contain your outline. Once you do that, you'll find yourself in the hnb editor, ready to create your document!

BTW, hnb does have an “undo” command (unlike “nano”), but it will only undo the last edit you made, so I highly recommend saving your work frequently just in case your outline gets messed up so you can quit without saving! (It would not be a bad idea to have backup copies of your work as well). Here's a table of some keystrokes you're bound to find useful:

Task

Keystroke

Moving vertically through the outline.

Use the Up and Down arrow keys.

Expanding or collapsing a single subtree

Move cursor to item, then press right or left arrow keys.

Expanding or collapsing an entire subtree

Move cursor to item, then press the [ or ] keys.

Insert a new item immediately under a current item

Move cursor to target location, then press the Insert key.

Begin a new subtree

Move cursor to target location, then press the right arrow key.

Delete an existing item

Move cursor to target item, then press the Delete key.

Copy and paste items

Move cursor to target item and use Ctrl+c and Ctrl+v.

To indent or outdent an item

Use the > and < keys.

Save the current file

Press the F2 key.

Activate the popup menu

Press the Esc key.

Expand or collapse all subtrees in the outline

Press F10, then F3 to expand or F4 to collapse. (Note: the global collapse doesn't seem to work with putty.exe, but try doing this from the popup menu.)

Edit an existing entry

Move the cursor to the target item, then press the Enter key.

Move quickly through the outline

Press PageUp or PageDown.

To quit hnb

Type Ctrl+q.