Text Editors

The Standard Text Editor: ed

One important topic that has not been discussed is how to actually get text into files. The early options were not pretty. Imagine typing at a teletype printer without being able to see the entire file! At this time, all that was available were line editors. The first line editor on Unix is named ed (ee-dee), and due to backwards compatibility concerns ed is still available on every Unix or Linux machine. Let's do a quick editing session to see what ed is all about.

# ed myfile.txt
hello world
hello summit

Whoa, that's pretty terrible. Just as the command line can be an intimidating environment, ed has been described as not fit for mortals. Issue the q (quit) command to exit ed.

ed is important because of what it introduced in to computing: regular expressions. One of the power tools of the shell is named after an operation from ed. Let's use the grep command real quick to better understand ed's legacy.

# grep hello myfile
# grep world myfile

Screen Editors


vt100 glass teletypeIn the mid 1970's, glass teletypes became all the rage. And with this new invention, the possibility of seeing the file you are editing became possible. Similarly to ed, some of these ancient screen editors still remain, a few of which have devout followings. The vi editor took some of the basic ed commands and adapted them to a cursor and screen based editing environment. Today, the vi editor lives on through vim, or vi iMproved. vim (lucky for us) comes with its own tutor program.

# vimtutor

vim is incredibly powerful and has many features that are useful for programming. It's learning curve is, however, prohibitively steep. Still, if you are stuck in a command line environment and have to edit a file (like one that requires root privileges), knowing enough ed or vim is helpful.

GNU nano

A simple screen editor is the GNU project program nano. With simple key combinations, common operations like copy and paste and save and quit are clearly marked at the bottom of the page. Go ahead and edit the file from earlier to get a feel for nano.

# nano myfile.txt
# cat myfile.txt

Modern Text Editors

Modern text editors live within the graphical user interface rather than the terminal. Still, for certain tasks a terminal based editor is still useful, and many developers prefer editors like vim. Still others prefer more robust integrated development environments (IDE) like IntelliJ, Visual Studio, or XCode. One important difference between a text editor and an IDE is that IDE's tend to be focused on specific languages or platforms whereas text editors are purposefully general. Some popular modern text editors include:

Last modified: Tuesday, 16 June 2020, 5:29 AM