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.
nano/pico links
JupyterLab Text Editor:
If you log into JupyterLab there is an editor available. You can find documentation here.
https://jupyterlab.readthedocs.io/en/stable/user/file_editor.html
emacs
emacs is a very powerful editor with a large number of features and a nearly unlimited ability to customize. This one is PGs favorite, but he is old school...
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-xthen control-s.
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. |
Many more commands are available, see the links below to learn more. |
---|
For emacs documentation see the following sources:
The GNU Emacs Manual is the mother lode of emacs information.
How to use Emacs provides a brief introduction
Browse the Emacs Info Page on Galileo
Notes:
By default emacs has an annoying split screen. You can disable that by adding a “.emacs” file in your home area with a special incantation. This works like the “.bashrc” file – but it runs every time that you start emacs.
For now, you can copy mine. Login to rivanna and run this from your home directory:
cp ~rcg6p/.emacs ~/.
That is it – next time that you open emacs, there should be no “splash” screen. Emacs can be customized in many ways from this file – but none of that is required.
FYI – Here is the incantation: (setq inhibit-startup-screen t)
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 Emacsallows you to change the default font. To do so, simply open your ~/.emacs file (using nano, or emacs) 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.