As a professional and recreational programmer, I spend a lot of my life energy working with text editors. Since 1995 I've spent a considerable amount of time using BBEdit, vi, vim, pico and XEmacs. Before I get into discussing each of these editors. I want to talk about my "text editor philosophy" just a bit-- what drives me to make the strike the balance that I do.
First, I need an editor that doesn't crash. Thankfully, all the editors I'm discussing rarely ever crash, so this isn't an issue.
I need my text editor to get out the way and allow me to get my work done. That means it is ideally transparent to learn and efficient to use. In the beginning, looking at my choices from the pespective of a Mac user, I expected that the ultimate editor would be extremely easy to learn, with a grand GUI that showed me most of options at a glance. This is how I got hooked on BBEdit on the Mac, later on XEmacs on Unix, and pico in the terminal.
After committing some time to learn the unituitive vi, I had a shift in thinking. vi felt difficult to learn initially, but was much faster to use once I had learned it. I realized I was very willing to invest a little time in learning to use my text editor especially if it was going to repay me many-times over in efficiency later.
I feel the vim editor bridges the "hard to learn" gap considerably, though. The default distribution includes
the vimtutor program which makes it easy and fun for new users to get started with it, and there is
excellent online help and online community to support it.
I'm also interested in supporting projects that are free and open source because they are in line with my values.
I used BBEdit from versions 4.5 through versions 6.1. The latest version strikes a fairly nice balance as a user interface-- I can use quick keystrokes for many functions for speed, and I have menus and palettes around for reference to help me learn new functions and access those I use infrequently.
It's "Search and Replace" system is the best I've seen on an text editor I've used, ever. I feel I hardly need to write about BBEdit, because it's already regarded as an excellent editor on the Mac, and it seems to have no close competition from other native Mac applications I'm aware of.
I eventually gave it up because I found vim more powerful and efficient to use. I did try using XEmacs on Mac OS X through a rootless X11 server in the meantime, but I found it especially slow and cumbersome in this context.
For a long time pico was the only text editor I used on unix. Back then, I was using unix only through terminal sessions. The only other terminal editor I heard much about was "vi", which as I Mac user I thought was insane and broken because it didn't have a graphical user interface. You have to learn some keystokes just to start using it! Horror!
pico was very easy to learn how to use. Like the Mac applications, it actually had a menu system on screen.
I was content with pico for a long time because I did most editting in BBEdit and just used pico when I had to edit something on the server that I couldn't get to through my Netatalk share or edit via FTP. One day I was hired to do some work on a remote unix server that only had vi installed. I decided to take the time to learn to use vi to do all the things I could do in pico. I would force myself to use vi for a task, consulting a reference as needed to accomplish what I needed. It was painful at first, but within a few days I found that not only had I become as proficient in vi as I was in pico, but I found that vi could do more than pico and was much faster to use. I never went back.
Having a text editor that's easy to get started with is nice, but considering the vast amount of time I spend using an editor versus learning it, the time spent learning a more powerful and efficient editor repays itself many times over.
I appreciate vi because it loads instantly, is fairly powerful, runs in the terminal and is available by default on nearly every unix installation. When I'm visiting on someone else's unix server for a quick job, I can depend on vi to be there to help me get my job done.
However, I now use vi only when I have to, because vim does everything vi does plus much more, including extensive online help. I recommend using vim instead of vi simply for the ability to have color syntax highlighting in the terminal.
I became an XEmacs user when I started using FreeBSD at home and was looking for a replacement for BBEdit. I liked XEmacs because it "felt" like BBEdit more than any other unix text editor I could find, in terms of having an extensive graphical interface, and being full of serious and useful features. In time I came to prefer it over BBEdit because of the "viper" mode, which allowed many vi keystrokes to be used, and because I found it had more features than BBEdit did.
Note: this section is no longer being maintained because I no longer use XEmacs or BBEdit.It was written with BBEdit 6.01 in mind. See also: XEmacs for Web/DB development. Skip on down to the vim section if you don't care about these differences.
The discovery of XEmacs/viper was exciting because it meant that I would be able use the vi keystrokes that I had already learned and found productive, and still take advantage of the advanced features of XEmacs. Here's how XEmacs and BBEdit compare with some of my favorite features:
.netrc file. This is a nice solution because the information is available to other programs
you want these short cuts for as well, such as the command line FTP tool. I found documentation on the .netrc
syntax by using man ftp on FreeBSD 4.2.
;; To enable syntax highlighting by default in all buffers, as well as
;; keeping the highlighting up to date as you edit the document.
;; Thanks to Daniel Pittman <daniel@rimspace.net> for this tip.
(setq font-lock-auto-fontify t)
XEmacs allows you to make some tradeoffs between the speed and accuracy of the highlighting which BBEdit doesn't. For example, XEmacs can just highlight what's visible on the screen, if you don't mind it being a little inaccurate.
# q } <LI>One frustration I have with this BBEdit is that I can't test projects directly because the Mac doesn't have some library I'm calling on the Unix system, or I'm doing something else a bit Unix specific.
XEmacs, from what I can tell so far, matches and exceeds all of BBEdits functions for editting Perl. This isn't surprising since XEmacs and Perl are both Unix-centric applications. I imagine the XEmacs Perl feature I'll come to appreciate the most will be the tightly integrated running and debugging system. I can test the perl script without leaving Xemacs, see the output and any errors produced, and step through the errors in the code. BBEdit has a similar function, but it's not as useful when I get an error returned on the Unix server want to quickly jump to that line number on my Mac.
sql-transform.el from
here which can convert one style of SQL
statement, such a select statement, into the other styles: insert, update and delete. This is useful for
making several statements to work on a table. It also serves as a SQL formatting tool.
;; relate .sql files to sql mode
(setq auto-mode-alist (append (list (cons "\\.sql\\'" 'sql-mode))
auto-mode-alist))
;; allow the ability to transform some SQL statements
(add-hook 'sql-mode-hook
(function (lambda ()
(local-set-key "\C-cu" 'sql-to-update))))
;; turn on syntax highlighting and build a handy menu when I enter SQL mode
(add-hook 'sql-mode-hook 'imenu-add-menubar-index
'font-lock-fontify-buffer )
grep and grep-find which over interfaces
to the unix grep and find utilies, allowing you to step through the results and see a
history of searches you've done. I like this because it allows to use the syntax I've already learned for these
command line utilities instead of learning yet another syntax. It's still not clear to me how to a complicated
multi-file find and replace within XEmacs though. I think the find and replace utility is the graphical element
of BBEdit that I miss most in XEmacs.I originally tried vim because it had all the features of vi plus color syntax highlighting that would work in a terminal window. For a while I was using vim on the server, BBEdit on my Mac desktop, XEmacs on my home unix workstation, and pico to edit e-mails in pine. All the switching back and forth was disorienting. I wanted to spend more time focusing on my tasks and less on the nuances of the editor I was using.
As I learned more about vim, I found it had many of the features I liked in BBEdit and XEmacs. I found it was often faster than XEmacs and needed less configuration and customization to get it to do what I wanted.
I came to appreciate vim's elegant integration with unix. With XEmacs, it seems that interfacing well with
external software nearly always meant adding more code onto XEmacs and giving the user a second interface to learn.
I spent a lot of time trying to get XEmacs to integrate with Postgres through it's own interface, and it never did
work quit like I thought it should. I think was partially do to XEmacs having it's own kind of "terminal" built in,
which was missing some features that some parts of psql expected.
With vim, I can use the syntax for the command line tools I already know. Here are some examples:
:grep [term]
[files]. vim keeps track of the results and allows me to easily few all the results and jump from one
match to the next.:w !psql -d db_name:!cvs commit -m 'Bug Fix: it works now!' %bash shell, but
less than the pine mail reader.syntax directory distributed with vim 6.1, it appears that
it knows how to syntax highlight over 300 different file formats out of the box. E-mail is one of them. I use vim
to compose my e-mails in mutt. Headers appear in one color, and each level of reply indentation is
colored differently as well. It's nice to have the same editing features available for all my needs.
KDE. 3.2 will allow kvim to be
used as the embedded editor within KMail.:!aspell -c %vim also integrates with some of my favorite web develop tools directly:
:make and vim will save the file, run it through perl -cw and then show me a list of
errors that I can either step through or jump to directly. Because I'm running vim on the server, all the modules
and path name are just as the script expects.:make and
a list of HTML validation errors will be presented that I can step through using the same interface that I use
with Perl. Alternately, I can instruct tidy to fix as many problems with my HTML as it can
automatically.For me, vim strikes a balance that makes it the best choice for nearly every task. I can use it on my Mac and Linux workstations, on remote servers, even for writing my email. I find that it's well suited for the quick edits that I used pico and vi for, and it's also an excellent choice that the complex projects that XEmacs and BBEdit are built to tackle.