Subscribe to
Posts
Comments
NSLog(); Header Image

QotD: CLI Text Editors

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.

14 Responses to "QotD: CLI Text Editors"

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. 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.)

  6. 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.)

  7. 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.

  8. 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.

  9. 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. 😀

  10. 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.

  11. 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
    $

  12. [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.

  13. 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.

  14. 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.