There are many editors available for Linux, however the most common are briefly outlined below. Nano is arguably the most simple for the first time user, Vi and emacs are more powerful, while nedit is good for those used to a windows environment. Which to use is down to personal preference.
Below is a very brief guide to each, with some of the most common commands highlighted. As with most apps, copy and paste via the mouse (highlight and middle mouse button with putty or exceed for instance) are available as well as internal copy and paste commands.
nano (formerly pico) is probably the simplest standard editor and appears at first glance as most Windows text editors do - called with nano filename, if filename doesn't exist a blank page opens ready for composition, if filename does exist then the file is opened for editing. Unlike many console apps, pico can't be put to the background with CTRL Z. Start with nano -w filename to turn word wrap off
|Save||CTRL + o|
|Exit||CTRL + x (then confirm|
|Cut line||CTRL + k (within nano only)|
|Paste line||CTRL + u (within nano only)|
|Find||CTRL + w (then enter search string|
|Find again||CTRL + w|
|Find line number||CTRL + w CTRL + t|
|Next page||CTRL + v|
|Previous page||CTRL + y|
|Help||CTRL + g|
nedit is a simple graphical editor, which can be customised and functionality extended using macros.
vi (vim) is a more powerful but more complicated tool, allowing for elegant mass editing of text. Vi can be started either with the traditional vi filename or when lessing a file, by pressing v (note exiting vi here will return to the less view). Vi has many commands allowing for all sorts of editing shortcuts, the most common presented below. Unlike Nano and Windows editors, a new vi session does not immediately allow you to write, instead you must invoke the insertion mode (i or a etc). Pressing ESC then exits the editing mode and returns you to reading mode, enabling you to save etc. Part of benefit of vi is the ability to incorporate sed commands into the editing, which is very useful, lots of instructions available through search engines.
gvim is a gui version of vi (vi is "vi iMproved") which may be more intuitive for a beginner.
|Save and exit||:wq|
|Insert (before cursor)||i (ESC to exit)|
|Append text (after cursor)||a (ESC to exit)|
|Open new line below||o (ESC to exit)|
|Next page||CTRL + f|
|Previous page||CTRL + b|
Click here for an vim reference card.
Similar to vi, emacs is a more powerful editor. It allows users to create macros and fine grained customisations. The emacs short cut keys are the ones used for the BASH shell. There is a plethora of documentation and good books available on emacs, with support for the many programming languages, LaTeX and shell scripting. Below is a screen shot of emacs.
To edit a file in emacs, type
emacs -nw filename.tex - the table below lists the most common emacs functions.
|Load filename|| |
|Cut line|| |
|Paste line|| |
|Find forward|| |
|Find reverse|| |
|Beginning of document|| |
|End of document|| |
|Page up|| |
|Page down|| |
|Upper case word|| |
|Lower case word|| |
Click here for an emacs reference card.