This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Tools & Utilities

Don't forget the text editor

By Alan Berg on June 26, 2008 (4:00:00 PM)

Share    Print    Comments   

Text editors are important for many tasks, from editing configuration files, nudging cron jobs, and manipulating XML files to quickly pushing out a README. Luckily, there are a number of interesting editors available. Here's a brief introduction to nine intriguing choices. While some may be better suited to certain tasks, it's no one tool is better than another for all tasks. Try them all and use the ones you like best.

vi

Old favorite vi (or one of its variants, such as Vim or Elvis) is available on most *nix systems. If you are a system administrator moving from one *nix system to another, the one reliable fact is that vi will work, macros and all. Once you have learned the keystrokes, swapping words at the boundaries, replacing sections of text, or transversing through a large file with vi is efficient, fast, and predictable. However, its initial learning curve is somewhat steep, and there is no real GUI.

Gedit and Kate

Gedit (see figure 1) is a small and lightweight text editor for the GNOME desktop, and the default text editor for Ubuntu. An excellent tool with syntax highlighting for a wealth of scripting and programming languages, it allows for extension via plugins (figure 2) and does most tasks efficiently, without fuss.

The editor is modern in design, with a tab per open file, thus allowing for easy cut and pasting between documents. The interface is uncluttered and somewhat configurable via Edit -> Preferences for such attributes as the enabling of allowing line numbering and changing tabs to spaces.

You can also run Kate (KDE Advanced Text Editor) under the GNOME desktop. However, you will have to install its package with a command like sudo apt-get install kate-plugins, which will also install some extra plugin-enabled functionality. Kate has a slightly busier interface than Gedit (figure 3), and to use tabbing between documents, you must activate the feature via enabling the correct plugin. But Kate is significantly more configurable than Gedit, exposing more of its innards as preferences.

An immediately helpful feature is the ability to hide code that is within a certain scope. For example, to hide all the code within a foreach statement, double-click on the offending line. This is a significant help for uncluttering verbose scripting text. Also, under the Tools menu, you can change the end of line type to switch between Unix, DOS, and Mac, thus avoiding subtle issues in your text later.

Both Kate and Gedit support quick ad-hoc editing of numerous scripting and programming languages. They are both excellent editors for a variety of tasks.

TEA and Emacs

Emacs and TEA are more complex and configurable than Gedit and Kate, with a much wider scope of potential abilities. If you want to work within a single environment, including sending mail, then these adaptive tools have the power to let you.

TEA (figure 4) is a compact, configurable, and function-rich editor that takes up only around 500KB of memory. TEA provides a decent text editor, with markup support for LaTeX, DocBook, Wikipedia, and HTML. It does not provide any syntax highlighting, but does provide an extremely basic project environment for compiling code.

Thankfully, TEA also contains a delightfully named crapbook (read notes holder) for storing temporary text. The editor provides a spell checker and statistics for documents and therefore sits comfortably between an office suite and a plain editor. Other functionality includes a file browser and a calendar. Because the editor's compact size is based on the fact that it relies heavily on using external tools, under the Help menu there is a well-thought-out self-check command that on activation mentions any missing dependencies.

You can extend TEA via manipulating text files to expand specific features. For example, to add your own command to the Run menu, open the ext_programs text file via File -> Manage utility Files -> External programs to add the option xterm, which activates -- yes, you guessed it -- an xterm window. Add and save the text on a new line:

xterm=xterm &

Emacs (figure 5) is powerful, feature-rich, and configurable. This tool has a long history reaching back as far as 1976. Originally written by Richard Stallman and Guy Steele, Emacs split into two main branches, Xemacs and Emacs, in 1991. The functionality in both branches is comparable. Having a long and renowned history implies fitness of purpose and core stability.

Emacs is not only a text editor but also an interpreter for Emacs Lisp, an extension of the Lisp programming language. Elisp makes scripting relatively easy. If you are a power user, you can tweak the .emacs configuration file (or whatever your local equivalent is) to, for example, add extra menus.

People have written a large number of modes in the Elisp language exist. A mode is an extension, modification, or enhancement. For example, one mode may be for SQL development, and another for Perl programming. The main Emacs wiki details the most up-to-date information and lists a full set of potential modes.

Emacs' default GUI is succinct and contains much functionality beyond editing. You can perform file navigation, send out email (if configured correctly), and perform specific tasks such as debugging, patching, and creating diffs with a few succinct keystrokes.

The software's documentation and international language support is superb, and the editor includes an online tutorial.

Gaining full mastery of Emacs, even for the cleverest among us, requires patience and time. The intuitive use of buffers or the memorizing of Ctrl and Alt keystroke combinations is a chore, but if you perfect it, expect massive gains in efficiency.

Leafpad, Mousepad, and Medit

If you are looking for a simple editor that does the bare minimum, then either Leafpad or Mousepad will fulfill the basics. They look the same and allow for word wrap, line numbering, auto indent, and a choice of fonts, and not much else.

Medit is a straightforward text editor with syntax highlighting and tabbed panes. To add an entry to its configurable tool menu (figure 6) select Settings -> Preferences then highlight the Tools option. Clicking on the new item icon (the picture of a document with the orange circle at the bottom center) activates a dialog. Change the name of the item from "new command," then add the entries displayed in figure 5. You will then have a new tool that lists in the currently selected document all the running processes (figure 7). For the devotees, Medit has its own scripting language, called mooscript.

The editor also has a well placed expandable no fuss file selector that is readily available via a click on the right side of the main window.

SciTE

SciTE, the Scintilla-based text editor, offers some of the features of a programmer's interactive development environment. It supports tab panes, syntax highlighting, and code folding, and goes a solid step further for programmers. For example, on opening a Perl file, or numerous other languages, you can check a script's basic validity via the menu option Tools -> Check syntax. That displays a second window (figure 8) with the gruesome details.

SciTE presents a no-fuss, easy-to-learn approach to controlling a scripting environment. A development tool like Eclipse will give you more features and adaptability, but also a steeper learning curve.

Final comments

This article covers only a fraction of the available text editors for the Linux desktop. If I have missed your favorite, share your opinion and place a link in the comments section for this article.

Alan Berg Bsc. MSc. PGCE, has been a lead developer at the Central Computer Services at the University of Amsterdam for the last nine years. In his spare time he writes computer articles. He has been a technical writer, an Internet/Linux course writer, and a science teacher.

Share    Print    Comments   

Comments

on Don't forget the text editor

Note: Comments are owned by the poster. We are not responsible for their content.

Don't forget the text editor

Posted by: Anonymous [ip: 204.184.160.238] on June 26, 2008 04:08 PM
You forgot Geany :-(

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 165.139.169.187] on June 26, 2008 04:38 PM
For really simple tasks I like nano.

#

Re(1): Don't forget the text editor

Posted by: Anonymous [ip: 38.101.153.26] on June 26, 2008 06:42 PM
+1

#

Re(1): Nano is an excellent editor

Posted by: Anonymous [ip: 76.105.87.205] on June 29, 2008 08:42 PM
for barebone configuration file editing.

OK, so I am the only one using it to edit system config files 'cause, you know, I am not well versed in vi or emacs.

OK, OK. Sometimes I use joe, mcedit, but nano sounds a lot more... geek. Nano, pico... Is there a femto editor?

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 69.136.110.192] on June 26, 2008 05:03 PM
Geany is more a basic(but very good) IDE rather than a text editor. Would you edit your shopping list file in Geany, for example?

#

Re(1): Don't forget the text editor

Posted by: Anonymous [ip: 81.84.75.196] on June 26, 2008 05:59 PM
if geany is an IDE then emacs is certainly _THREE_ operating systems

#

Don't forget the text editor

Posted by: Anonymous [ip: 212.101.1.113] on June 26, 2008 04:44 PM
I go for joe - small, flexible and fast, with nice features for developers like indentation, syntax highlighting and bracket selector.

#

Don't forget the text editor

Posted by: Anonymous [ip: 129.128.212.214] on June 26, 2008 05:33 PM
Where is GVim?

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 171.159.192.10] on June 26, 2008 05:52 PM
vim.org for the Win32 version; vim-gtk/vim-gnome DEB packages; vim-X11 RPM package (yum search vim)

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 87.66.91.30] on June 26, 2008 08:43 PM
GVim ? Have a look at it's latest incarnation: Cream http://cream.sourceforge.net/.

On it has tabs and uses windows friendly shortcuts by default. Yet under the hood, you still have a full blown vim.

Cheers,

B

#

Don't forget the text editor

Posted by: Anonymous [ip: 69.12.128.128] on June 26, 2008 06:01 PM
From the "vi" post... Several things are wrong.
1) Nobody uses "vi" anymore.. its "vim" or "vi improved". If you type vi on almost any modern distro its often just a symlink to vim. Its not really a variant anymore.
2) "However, its initial learning curve is somewhat steep, and there is no real GUI.".... Wrong. There is a GUI called "gvim".
3) Length: I think 4 sentences is FAR too short for an editor that has been around as long, and still used more widely than emacs (which was the largest section of the article). A lot of upsides to Vim are not even mentioned.

#

Re: Don't forget the text editor

Posted by: Lennie on June 26, 2008 08:14 PM
On OpenBSD I use vi and Debian comes with vim-tiny, which is kinda ok, but it's not the nvi I was used to from previous versions.

#

Re(1): Don't forget the text editor

Posted by: Anonymous [ip: 172.20.48.58] on June 27, 2008 02:14 PM
Ya, vim-tiny is only good for simple editing. I can't even set columns=80 on that. Its not picking up etc/vim/vimrc file at start. lot of restrictions. If anyone want the legendry 'vi', install full 'vim' package from your repository.

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 60.51.120.163] on June 28, 2008 02:17 AM
You can find a comprehensive tutorial to Vim here: http://peyman.taher.googlepages.com/vim%2Cstepbystep

#

Don't forget the text editor

Posted by: Anonymous [ip: 89.175.165.2] on June 26, 2008 06:22 PM
"Nobody uses "vi" anymore.."

I regularly use Solaris 7 and HP-UX 11.00, you insensitive clod. What vim are you talking about?

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 69.12.128.128] on June 26, 2008 07:00 PM
Well obviously if you're on Hpux or solaris you'll be using vi. But surely I would download and compile vim if I spent any time using the old vi.
Plus.. seeing as this is LINUX.COM, when i said "nobody", I meant "Nobody on linux".

#

Re(1): Don't forget the text editor

Posted by: Anonymous [ip: 76.189.117.63] on June 26, 2008 08:48 PM
I use linux, and I have both vi (http://ex-vi.sourceforge.net) and vim (http://www.vim.org). Distros nowadays don’t seem to realize that vim is not vi. When I type vi at the prompt, I want vi (or at the very least vim in compatibility mode). Had I wanted to use vim (I occasionally do), I would have put that extra ‘m’ at the end.

#

Don't forget the text editor

Posted by: Rubberman on June 26, 2008 06:48 PM
It may be getting a bit long in the tooth, but I still really like nedit (found on SourceForge, originally developed at FermiLab). Good context-sensitive editing, user macros, powerful regex search and replace across multiple documents, etc. It's a lot lighter weight than emacs, as well as easier to learn. It runs on just about every platform known to personkind, including Windoze and QNX.

#

Don't forget the text editor

Posted by: Anonymous [ip: 70.77.17.189] on June 26, 2008 07:39 PM
Don't forget the true basic editor, the line editor ed, of which vi is a screen-oriented extension. ed is present on every Unix system and can be run on any terminal-like device, including single-line printing terminals. For quick little changes it is the fastest and least obtrusive way to do.

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 172.20.48.58] on June 27, 2008 02:17 PM
+111111111111.... The best way to learn 'regx' is to study manpage of 'ed' command.

#

Don't forget the text editor

Posted by: Anonymous [ip: 83.100.202.208] on June 26, 2008 07:45 PM
I like nano for quick edits and emacs for anything else myself, though as I'm trying to learn to use emacs better I'm trying to phase out my use of nano. Vim just confused the hell out of me.

#

Don't forget the text editor

Posted by: Anonymous [ip: 24.84.196.212] on June 26, 2008 10:07 PM
Once I learned vi/vim I never had to learn any other command line editor. Emacs was just too complicated. Kate is fine for the desktop.

#

Don't forget bluefish

Posted by: Anonymous [ip: 84.193.137.40] on June 26, 2008 10:29 PM
Just chipping in:
I really like Bluefish a lot, actually - you can store projects and tabs opened, a lot of configuration options, tabs, file and folder listing for a base path of a project ...

#

Don't forget the text editor

Posted by: Anonymous [ip: 64.147.9.101] on June 26, 2008 10:59 PM
I like MS Notepad personally. There is no greater fun than going through the hassle of installing Wine so I can pollute my nice Linux system with .dlls. : )

#

Don't forget the text editor

Posted by: Anonymous [ip: 193.254.61.192] on June 27, 2008 01:20 AM
Too bad many of these editors have some fatal flaw that prevents them from bein used as a lightweight programmer's editor.

Many of them don't have jump to matching bracket or block [un]indent. Kate doesn't have autoindent (or it works only on certain filetypes) and if you trigger the opening of a new file it exhibits a completely brain-dead behaviour (opens a new window with everything from the first window duplicated). They each use all kinds of shortcuts to switch tabs, but never Ctrl-Tab (Gedit doesn't seem to allow tab switching from keyboard at all). Nedit doesn't know Unicode (come on, it's 2008 FFS). And so on and so forth.

The only acceptable lightweight programmer editor I've found is Medit. It has its shortcomings but it's the most usable of the bunch (for a programmer).

#

Re: Don't forget the text editor

Posted by: Anonymous [ip: 69.12.128.128] on June 27, 2008 02:04 AM
Vim has all this. It highlights matching ['s and {'s or jump between them with '%'. Also, you can block [un]indent with visual mode and/or '>>' and '<<'.
You also can modify the tab switch key to be whatever you want in vim. Vim also has smart and auto indent.

#

Don't forget the text editor

Posted by: Anonymous [ip: 125.164.205.138] on June 27, 2008 04:19 AM
where's is my favourite editor, KWrite? :)

#

Don't forget the text editor

Posted by: Anonymous [ip: 68.127.170.163] on June 27, 2008 04:36 AM
vim in environments that are slow such over dialup or do not support gui.
kwrite or similar (notepad) for a quick look or change where GUIs are supported.
jEdit in all other cases. jEdit is remarkable also considering it is FOSS. Ive beed using it for a decade - mostly for C code editing. Dont let the "j" confuse. All it means is that it is written in java - not also that it works only for java editing. Among its features are support for many languages, split windows, vertical block cut/paste, numerous plugins incl diff and beautifier. Its strongest feature is its search allowing find/replace throughout a directory tree and file opening and positioning from click on search results list. The learning curve is gentle - no commands to remember. And it never misbehaves.

#

Why vim?

Posted by: Anonymous [ip: 137.229.96.111] on June 27, 2008 04:39 AM
I'm a big Emacs fan. Don't you vim people find it annoying to have to constantly switch back and forth between command and text-insertion mode?

#

Re: Why vim?

Posted by: Joe Barr on June 27, 2008 04:51 AM
Lots of people like Emacs, and it's easy to see why. I mean, if it included a decent editor, it would be one of the best OSs out there. ;)

#

Re(1): Why vim?

Posted by: Anonymous [ip: 60.51.120.163] on June 28, 2008 03:27 AM
Well you need few more fingers that you have to do thing that can do with few fingers in vim ;-)
Try vim, you it won't disappoint you. Maybe you can start with a vim tutorial (I like this one: http://peyman.taher.googlepages.com/vim%2Cstepbystep)

#

Re: Why vim?

Posted by: Anonymous [ip: 83.3.201.202] on June 27, 2008 06:55 AM
In fact no! I did not understand this before I started to use this and now I can't live without it. Really. You should try this one day.

And this article is really sad not to include vim. It includes many next to unknown editors + emcas but no vim? Seriously...

#

A rather unfair treatment of Vim

Posted by: Anonymous [ip: unknown] on June 27, 2008 08:19 AM
Good article but not useful enough, especially considering your unfair coverage of Vim. Not to mention that no link was given; http://www.vim.org. This is such a powerful editor that it deserves more credit. Surely, it is in the same league as Emacs and no other editor.

Vim is very feature rich. Basically supports all the above mentioned features and more, e.g;
- syntax highlighting
- plugin support via its scripting language
- easy and very flexible configuration in ~/.vimrc
- folding (hide code within a certain scope,
- and so on.

Unlike mentioned in your article, there are several GUIs for Vim including gvim and kvim.

One more feature, you can also add menus to the gui (:nmenu).

I strongly agree with a previous comment; Sad that vim is not included. Perhaps the author of this article has little or no experience with Vim.

#

Re: A rather unfair treatment of Vim

Posted by: Anonymous [ip: 71.160.30.138] on July 05, 2008 04:57 PM
Unfortunately the author who wrote this article has very little depth. You'll notice the article says all your macros will work no matter what *nix system you are on with vi?! I get the impression he may think vi and vim are the same too. Over the decades I've had to learn to break up my macros into sub categories depending on which version of vi I'm using. Sure, they all have the equivalent of a gas pedal that works with your right foot. Unfortunately all the bells and whistles are not all present with all cars and they are certainly not all present with different versions of vi included with the various OSs.

So take his article as a fluff piece. He's obviously pandering to the newbs who think there are other editors out there that should be used besides vi/vim...

#

Don't forget the text editor

Posted by: Anonymous [ip: 89.7.56.200] on June 27, 2008 01:22 PM
www.editra.org

#

Don't forget the text editor

Posted by: Anonymous [ip: 198.240.129.68] on June 27, 2008 02:47 PM
I usually use vi(m) but recently, I tried to open an xml file with gedit.
It refused to let me see the contents of the file - indicating that some validation error was preventing it from displaying it.
This is not the way a text editor should behave.
Perhaps the behaviour is adequate for a word processor, but its definitely not a good behaviour for a text editor.
.. or is there some button I could click in order to get gedit not to validate ? anyone ?

#

Don't forget the text editor

Posted by: Anonymous [ip: 78.86.141.22] on June 27, 2008 05:03 PM
What about Scribes?

#

Don't forget the text editor

Posted by: Anonymous [ip: 212.73.164.10] on June 27, 2008 07:16 PM
jed, it's just so awesome.

#

Don't forget the text editor

Posted by: Anonymous [ip: 82.44.206.119] on June 27, 2008 08:34 PM
kedit is nice and fast

#

Don't forget the text editor

Posted by: Anonymous [ip: 193.254.61.192] on June 27, 2008 11:54 PM
Not everybody is willing to use a modal editor like vim. I find it interesting that all the people who say "vim has all these nice features" forget to also mention "oh, and it has this completely crazy interface where you can't just start to type text, you need to learn magic keystrokes to do anything".

Face it, most people aren't willing to use a modal editor, they want WYSIWYG. vim is on the same level with DVORAK keyboards. Granted, it's a very nice and powerful and efficient editor, but it's strange and most people don't want strange stuff, they want a simple window where they can start typing text.

The same applies to Emacs: complicated interface and a horribly complicated application that happens to do text editing as a side effect.

The author of the article should have mentioned it was about graphical mainstream editors. Perhaps then there wouldn't be visits from vim or emacs fans come to pitch their godly editors to us mortals.

Back to topic: I find Scite an excellent lightweight programmer editor. Someone mentioned Medit, this is better than Medit. But on the downside, you have to spend an hour in the beginning in the configuration file. It reminds me of NEdit, except with a sane GTK+ interface instead of Motif and UTF-enabled.

#

Don't forget the text editor

Posted by: Anonymous [ip: 203.184.29.75] on June 28, 2008 03:10 AM
!!!!!!!! jEdit !!!!!!!
It is incredibly useful. It's the only text editor I know which has a block edit mode that does this: select a vertical zone and start typing. Whatever you type gets repeated over all selected lines. On the downside, its memory size is limited by whatever is available to java, and this climbs quickly. not fit for large amounts of data for example.

#

Don't forget the text editor

Posted by: Anonymous [ip: 71.63.207.25] on June 28, 2008 03:42 AM
Nice review.

Tea, however, seems to fall into that strange category of software that has no way to run it. I install it, and the terms tea, TEA and Tea typed at a terminal do not invoke it, and the documentation available on line on my quick inspection does not mention this nagging little fact.

#

Re: Anonymous [ip: 83.100.202.208] on June 26, 2008 07:45 PM

Posted by: Anonymous [ip: 90.227.187.99] on June 28, 2008 10:19 PM
If you like to "stay emacs" even for small edit jobs, try Zile, a lightweight emacs clone. I use it all the time when I just need to jot down some lines and don't have patience for booting emacs.

----->http://www.gnu.org/software/zile/

#

Other worthies

Posted by: Anonymous [ip: 72.204.223.246] on July 02, 2008 02:26 AM
http://scintilla.sourceforge.net/SciTE.html
http://towo.net/mined/
http://madedit.sourceforge.net

SciTE is crossplatform nicely compromises between simplicity and programming. It does block matching and syntax coloring.

MadEdit has hex editing and other features.

MineD has the best i18n/Unicode/CJK support anywhere.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya