Text Editors

From Linux 101, The beginner's guide to all things Linux.

Jump to: navigation, search

Text editors are the nature of so many important things to a Linux system. Yes, there are GUI ways to do things, but once you get used to doing them at the console, you will see they are much quicker and easier to do that way. These are important programs for everyone, but especially to programmers; these are the core tools for editing your programs.

A very basic list of editors is:

  • pico and nano
  • ed
  • vi and clones
  • emacs and clones

[edit] pico and nano

Pico is part of pine (which is a fairly popular console email program -- you may have used it around campus some already). Pine is licensed by its place of original creation, the University of Washington. Since they did not use the GNU GPL software license, some GNU developers came along and created nano. Nano is a clone of pico, so if you can use one, you can use the other. To start either, you can do:

pico filename
nano -w filename

Just as a small note, the -w in the nano argument just means do not wrap long lines (the default behavior of pine.)

The only thing that may confuse some new people is the menu at the bottom. The carot symbol (^) just means to hold control. So, when you see ^X, that just means hit CTRL-x.

The rest of the menus and how to use nano or pico is really intuitive.

[edit] vi and clones

Vi is a really old editor, and so many other editor programs have spawned off of it (most having "vi" somewhere in the name). However, the most prevalent of its children is vim (Vi IMproved). This is the clone that this article will discuss.

Vim is perhaps one of the most powerful console applications I have ever come across. You could read several books on the editor, and it would still have new features for you -- all of this, just for editing text.

In truth, I wish there was a simple advice like pico and nano's to give you to make you understand this power, but I cannot. Vim is far too powerful for this wiki to try and recreate all of the documents out on the web about it, so this article will point you in some good directions if you wish to pursue using it.

Vim also is available on many different operating systems (including windows) and also in a GUI as gvim. This is very convenient because you can learn how to interact with vim, but really can use it in many places.

As mentioned earlier on the discussion about man pages, the man page viewer interface is actually modeled after vi, as are other programs. This gives more reason to learn vim.

vimdoc.sourceforge.net 
Has all of the documentation of vim. The vimbook which you can download is very good to get some information out of.
vim.org 
Has all of the good links to information on it. Anything worth reading out there about vim can be found through here. After some basics are learned, glance at the Tips and Tricks pages.
The Vim Sheet 
This is a good reference put together by some Clemson students.

Vim does have a tutor, you can type vimtutor at the shell and learn all about vim. If you would like to start learning with an even easier configuration of vim, you can always try cream for vim.

[edit] emacs and clones

Emacs is the GNU edition of a text editor. It takes a radically different approach to text editing than vim (of course, in the end you still get the same task done). It is equally as powerful, but my knowledge of it is not very strong, so I will leave this section for someone else to contribute to. To gain a basic understanding, run through the built in tutorial. To do this, start emacs, type CTRL-H then 't' and follow the instructions.

Personal tools