QotD: CLI Text Editors
Posted November 2nd, 2006 @ 10:15am by Erik J. Barzeski
Question: What CLI text editor do you use (and why)?
My Answer: For years, I've used pico as my console text editor on various servers. I tried vi and vim, I tried emacs. I even tried joe for awhile. But I keep coming back to pico.
Despite the fact that I believe pico stands for "Poor Ignorant Console Operator," my text editing tasks aren't very large. I rarely need to copy and paste (and when I do, Terminal's copy-paste works fine). The search capabilities of pico are fine for me. I can page up and down pretty easily. There are no confusing modes (vi, I'm looking at you). It may be the most Mac-like console-based text editor out there.
I realize that I'm not even on the ladder of console text editors, let alone on the bottom rung. Just yesterday I installed nano (and aliased 'pico' to it in case old habits kick in) in an attempt to crawl just a little closer to that ladder.
Go ahead, hate on me all you want, and tell me which text editor you use and why.
You are encouraged to answer the Question of the Day for yourself in the comments or on your blog.
Posted 02 Nov 2006 at 10:32am #
I've always waffled between vim and pico (depending on how heavyweight an operation I was trying to complete), but avoid both at all costs ever since textmate introduced mate, their CLI link. It's Just Easier. Does that make me a failure of a nerd?
When ssh'ed into a remote server I fall back to vim, but I don't really see the sense in it in cases where I can get away with using TextMate.
Posted 02 Nov 2006 at 11:04am #
For Unix systems I go back and forth between vim and pico/nano, though I can't really do much more in vim than save and quit. Some systems I have an account on have really strange default vim configurations, so there I use pico/nano.
Posted 02 Nov 2006 at 11:27am #
When I have to, I mean in a console only environnement, I use pico/nano. Otherwise I use common GUI text editors, TextMate or SubEthaEdit for instance.
Posted 02 Nov 2006 at 11:47am #
I have tried emacs, pico, and the rest, and have found that only vi makes sense to me. So I use vi exclusively. I even use vi over TextEdit, TextMate, and TextWrangler.
Emacs not done here.
Posted 02 Nov 2006 at 1:51pm #
I use vim. I find that I can get things done faster in vim than in other editors, and in general it works the way I expect. When I first learned UNIX (ten years ago) I was first told to use emacs. But emacs never really made much sense to me, so after a year or so I switched to vim and I've been much happier since then.
I normally use TextMate for local files, but as a UNIX sysadmin I have to deal with a lot of editing of files on remote machines, so I use vim quite a bit. (But I only use a small subset of its commands.. "i", "a", "j", "c", "s", "/", ":s", and a few others. on rare occasions I make use of a register ("q" and "@") if I'm doing something repetitive (creating a bunch of similar entries in a DNS zone file, for example.)
Posted 02 Nov 2006 at 2:01pm #
I'm mostly a pico/nano kind of guy (I either use terminal copy & pasting, or ctrl+k/u to cut lines), though if I'm doing serious stuff I'll either use emacs, or use TextMate with cyberduck.
On machines without pico I usually alias it to nano so I still have my muscle memory to rely on. (Oddly enough my ubuntu/debian boxes have it symlinked or aliased or something already.)
Posted 02 Nov 2006 at 2:36pm #
I almost exclusively use vi/vim. It started that way because since many of the machines I had to use (at school) only had vi, and now I am enamored with it.
Posted 02 Nov 2006 at 3:23pm #
vim, man. It's the best. TextMate on the Mac, vim on the server. Neat trick: cd to the directory of a project, and
mate .
to open the directory in TextMate.When you've used vim long enough, it becomes an extension of your mind. emacs users say the same thing, but I'm not an emacs kind of guy. pico and nano feel clumsy by comparison. The design decision to try to keep your fingers on the home row as much as possible is simply HCI genius. As for the modes, I'm reminded of the quip: "vi has two modes-the one when it beeps, and the one when it doesn't". Seriously though, the modality becomes second nature pretty fast, and makes sense. If you're dead set against it, I believe gvim has a modeless option. I've never tried it because I like my modes.
Posted 02 Nov 2006 at 8:17pm #
Kinda depends. If I'm doing a lot of coding on the command line then I tend to use emacs. But for the typical everyday console editing I use VI. The reason being precisely that it has two modes. I can be sure that when I go into a file and edit it, the change I make is exactly where I want it to. I've used to many editors that tend to like to add trailing newlines or that change line-wrappings or other odd things like that.
Also, vi is one of those ubiquitous editors. It's everywhere and it's always the same. I got jaded with emacs when the various systems I was working on all had different versions (emacs vs xemacs) and weren't compatible with my .emacs file. I finally threw away all my "worldly possessions" (the syntax coloring, complex macros and specialized .emacs) and went back to a more simple time and have been happy ever since.
With that all said. Using TextWrangler to edit files via SFTP[0] is frigging sweet. Wish I had a Mac at work...
[0] - Especially since Apple imported the version of OpenSSH that supports connection sharing (multiplexing). SSHing is now at the speed of light. 😀
Posted 02 Nov 2006 at 10:01pm #
I've been using joe for years but recently found a cheat sheet for VIM and switched over. Why? Because I got tired of not knowing how to edit files from the CLI without installing extra software on the boxes I admin.
Posted 03 Nov 2006 at 1:00pm #
On my Macs (client and server versions):
$ which pico
/usr/bin/pico
$ ls -l /usr/bin/pico
lrwxr-xr-x 1 root wheel 4 Jul 28 02:53 /usr/bin/pico -> nano
$ ls -l /usr/bin/nano
-rwxr-xr-x 1 root wheel 231088 Jul 1 21:49 /usr/bin/nano
$
Posted 03 Nov 2006 at 1:03pm #
[quote comment="20741"]On my Macs (client and server versions):
$ which pico
/usr/bin/pico
$ ls -l /usr/bin/pico
lrwxr-xr-x
1 root wheel 4 Jul 28 02:53 /usr/bin/pico -> nano
$ ls -l /usr/bin/nano
-rwxr-xr-x
1 root wheel 231088 Jul 1 21:49 /usr/bin/nano
$[/quote]
Something I meant to point out is that this is the "out-of-the-box" setup for Mac OS X.
Posted 03 Nov 2006 at 4:59pm #
I live in Emacs.
The steep learning curve is worth the efficiency payoff. People are amazed at how fast you can rip up text in it.
I program in Lisp a lot, and it's almost pointless to use Lisp, especially the free Lisps, without Emacs. I'd probably use it much less if it weren't for Lisp, since the Cocoa text system supports most of the Emacs bindings.
I often use the unix shell inside an Emacs buffer, but half the time I use Terminal.app. I use vi for tiny editing tasks, like configuration files, especially those on remote servers.
Posted 06 Nov 2006 at 12:15am #
Used Pine for email for quite a while growing up, so Pico was my natural choice for about 8 years -- until I started my current job, where I needed to edit text on Linux. I knew vi through various computer science classes, but didn't really have any desire to use it outside that context, until I ran into Linux. At that point I started to use vi exclusively, though I still have fond feelings for Pico. It's easily one of the most usable, most "mac-like" editors out there.