editors

Editing Text

The are a variety of text editors available on typical Linux systems. We introduce two choices below.

nano / pico

nano or pico is a very easy to use text editor. nano is more commonly available on modern linux distributions. nano and pico are functionally equivalent, nano was created with an open source license.

emacs

emacs is a very powerful editor with a large number of features and a nearly unlimited ability to support customizations.

You will ultimately prefer emacs because it automatically indents your code, and displays the relationship between beginning and ending braces “(),{},[]” as you type your programs. Both of these features help to avoid buggy code and encourage readability.

Emacs has two common modes.

• A graphical mode supporting easy to understand point and click operations. This is only available if your computer is running an X windows server. Emacs will typically default a non-graphical mode if your computer does not support X windows.
• The non-graphical mode runs inside of your terminal window, similar to pico/nano. This mode may be also be invoked directly by typing:
emacs -nw filename

in the non-graphical mode you need to know a couple of important commands to control the editor:

In the table below ctrl-x means you press the control key and the c key at the same time. ctrl-x ctrl-s means you press control-x then control-s.

 Many more commands are available, see the links below to learn more. ctrl-x ctrl-s Save the current buffer, do not exit the editor. ctrl-x ctrl-c Exit the edit. You will be prompter to save any modified files, if necessary. ctrl-s Perform a search.

For emacs documentation see the following sources:

Note: If you run Emacs and you see a variety of garbled text, or simply open squares where actual characters are expected, this is indicative of a problem with the fontset expected by the Emacs program and the one that can be displayed via the XWindows server you are using. If you encounter this issue, installing the xming fonts package sometimes helps, and sometimes it doesn't. Fortunately Emacs allows you to change the default font. To do so, simply open your ~/.emacs file on galileo (using nano) and add this line:

(set-face-font 'default “fontset-standard”)

This should use the same font as you've been using, but will save you the hassle of changing it through the menu every time. (Thanks to Rob Mina for the helpful instructions!).