This Time Self-Hosted
dark mode light mode Search

More explanations: why nano is Gentoo’s “default editor”

I say “default editor” in quotes because Gentoo really does not have a default editor, but rather a fallback-editor for whenever the users hadn’t chosen one themselves. And this is why stuff like the stage3, sudo, openrc and so on default to that when $EDITOR is unreliable (that is, until we can move to a full-fledged wrapper script).

Paul, in the previous post explained it quite well, albeit briefly, but since some other people asked me about that again, I’ll quote him and then go in a bit more of details:

… Third nano was kept as the default because it is small, straightforward, and easy to get out of when you don’t know it (let’s face it neither vi(m) nor (x)emacs is that easy to get out of). Fourth, by having the EDITOR/VISUAL variables point to nano (which is installed by stage2 as well as stage3) things would be working (although probably not optimal) out of the box. …

Indeed Paul speaks well: neither vi (or vim) nor emacs (or xemacs) is going to work. Why is that? Some people even goes as far to say that “it’s called *vi*sudo“ and “vi is the default Unix editor”. At the same time, I wouldn’t be surprised to hear “Emacs is the default GNU editor”. Well, let’s decompose it in two different problems.

Technical problem: the system set is messy already (and this is also “thanks” to my own pambase creation — which is, though, a solution to a previous problem). The packages that do enter the system set should be, whenever possible, small and with little dependencies. This includes, obviously, USE-optional dependencies, since when they are enabled, the dependencies also become part of the system set (like it happens with gnome and pambase). The dependency tree of nano is near invisible, while those of both vim and emacs are quite long (sure there are things like elvis, nvi, zile and jove, but this will bring us to the next point…).

Reality problem (or flame-retardant method): there is no way on Earth that any average number of people will be accepting to use the same editor as default, when taken from the list of “most popular” editors. Hey we cannot even find consensus among the three developers of lscube (I’m using Emacs – yeah I’m an Emacs user, burn me – and my colleagues using VIM and Eclipse). If we were to choose vim, all Emacsen users will complain, if we were to use GNU Emacs, both vim and XEmacs users will complain, and so on so forth. So we use nano, which is likely to make unhappy the most people, but all in the equal amount.

There’s a corollary to the reality problem above: if we were to choose any of the lightweight variants that I named above, or more of them, most likely the problem would be more or less the same, since almost all people would be pretty unhappy with the choice and would then unmerge that and install their editor of choice. But it would most likely upset the two “main factions” unequally, which would make one feel discriminated against.

Newbie problem: finally, there is another note: both Emacs and VI (and respective clones) aren’t exactly the most user-friendly editors. A newbie user who has no clue how to work in Gentoo is unlikely to guess at first sight how to use either of them, while nano is pretty much the easiest thing you might find around. You can fight as much as you want about powerfulness (Emacs and VI are obviously much more powerful than nano) and you can fight about relative easiness of use (:w versus C-x C-w) but nano is going to win over both of them in that regard.

So no, we’re not going to change the default anytime soon.

Comments 29
  1. I can’t believe you have to defend this obvious choice. As a lover of vim, it really doesn’t kill me to use nano to edit my make.conf and friends, then emerge vim. Besides, this is Gentoo, who has always been about leaving the choice to the user.

  2. With you all the way on this one. I switched from Mandrake to Gentoo many years ago. It was a hard enough transition without having to learn vi in the process. I’m still not familiar with vi and I only recently stopped using nano in favour of emacs.

  3. I myself like nano being the default. It actually tells you what keys to use by default. Neither of emacs nor vi tell you the keys to use by default, if at all. Whenever I fire one of them up or some lame version control program fires them up for me, I usually end up with the wrong sequence of keys to quit and it does something I don’t want. If I want something more powerful, I’ll fire up a graphical editor.

  4. I started using nano as my main editor because it was the default in Gentoo and available on all my Gentoo machines.It’s quick and to the point. If I’m writing code, I’ll take Kate or Eclipse over any console editor.

  5. I don’t care: vim is on of the first package I emerge when installing a gentoo, and that’s no big deal.

  6. Previously when I only used FreeBSD, the only thing I used vi for was to setup the system just enough that I could pkg_add -r picoNano as the default for the system makes perfect sense to me, and it’s what I use for any console editing I have to do (generally just config changes, sometimes some PHP code in a pinch). And it has syntax highlighting for both of those.

  7. Obviously correct. 🙂 Some small, simple, self-explanatory editor, anyway. While I’m another of those awful emacs fans, I reflexively use nano for small simple edits like tweaking configuration files. I reach for a more powerful editor only when I need more power.I’m somewhat prejudiced, since I already knew pico and therefore knew 95% of nano without study.

  8. “How do I save and quite” is probably the most common question I get from newbs who have bumped into vi or emacs.

  9. Shouldn’t the man page for visudo be modified?”This list defaults to the path to vi(1) on your system””This list defaults to the path to nano(1) on gentoo”

  10. yeah, laugh about DOS edit…. Somehow installing and running wine. my default editor in xfce4 is now windows notepad :(I need to reset it but I’ll probably wait until I get mad enough before I figure out where to reset it.

  11. Using Debian and have never used Gentoo, and thought never will.Hmm … this post makes me think twice … smart people using smart default.. I like it 😀

  12. The minimal install CDs do come with a small vi clone, as the “busyboxvi”:http://www.busybox.net/down… applet is built(onamd64 at least). So, for those of us who have seen the light we canjust use “busybox vi” until we’re in a state to emerge vim :)And, if you’re using it a lot you can always “ln -s /bin/busybox vi” tomake it easier to start.I was also going to post a tongue-in-cheek link to Ciaran’s e4r post,but I see Milan already beat me to it.

  13. LOL…I actually was stuck in emacs for over an hour trying to figure out how to get out of the blasted thing …not a week or two ago.

  14. Always thought that Gentoo should use vi(m) as the default editor. Though nano is good for new users is that really the target audience?As for emacs or Vim: I read an emac thread a while back that had a poll that was something like, “As an Emacs users do you know how to use Vim” with choice of “No”, “Enough to get by” and “Yeah, but I’ll chew my leg off before I do”. The last one was like 78%, so…

  15. GREAT and sensible post!nano helps new users cope a bit at a time, while vi or emacs would likely make people run away screaming, never giving Gentoo another look.If you want a live-cd with emacs or vim as default, who’s to stop you from MAKING one?Having an ‘easy’ and quite minimal default has always been what I liked about gentoo.vi/emacs just doesn’t invite people to ‘just take it for a spin without RTFM’ing, which would be what most people do. And when none of the key-combos you try seems to be doing anything, grabbing another pc and looking up the manual isn’t entirely attractive, either, even if you’re normally the type to do so…Imagine being stuck during phase 1 of the installation, with no extra pc and having just messed the boot sector… and you’re stuck in an unresponsive editor, nothing seems to work… how would YOU feel?

  16. I thank you for your choice. When i started out with gentoo, I knew little about it. A year latter, I’ve tried both emacs and vim – but have kept with nano – it’s that awesome.

  17. vi has been the default editor on Unix since at least the seventies.there should be at least a link to a vi clone under the name “vi” on all unix like basic installs.i don’t object to you including other non vi like editors along with the basic package but on ANY unix like operating system, I should be able to simply type “vi” and get a comfortable, basic set of vi functionality.

  18. I didn’t read all the comments, but if no one mentioned it, busybox can be used for vi. So really, gentoo does have vi ready to go, even on the mini-install. Just `ln -s /bin/busybox /usr/bin/vi`.

  19. Nano is a fantastic default (vim user here) the only thing it lacks that could be handy for new users is syntax highlighting, not sure if there is a nano patch for this?

  20. bq. Always thought that Gentoo should use vi(m) as the default editor. Though nano is good for new users is that really the target audience?In short – Yes.My first Linux was Gentoo – and now I’m condemned since any other distro I try (I work as system developer/part-time-admin so I tried a lot of them) is just rather lacking (in lack of better expression to describe the disappointing feeling).If it was vi(m) or emacs as default – I would have probably given up on Gentoo right at the start.As said, nano for config and some quick code changes, Komodo (was Eclipse but it’s buggy so I switched) for real coding.

  21. I’m a GNU Emacs user and I’d rather use vim over nano. That’s how bad nano is.

  22. In my long sysadmin carreer I’ve have worked on many Unixes and Linux distros, including Xeinix, ISC, *BSD, HP-UX, Solaris, AIX and many other. And on all behavior was: if $EDITOR is not set then use vi. Because it was alway installed. And I know that when I login even into my wifi router with 4MB OpenWRT, there will be vi.POSIX and LSB says that vi must be install on compliant systems for a reason.And yes, visudo called because of vi. Same as vipw and vigp.I always thought that Gentoo was for power users. But if you want to cater for newbies, vim have “simple” modeless mode for people who should not be allowed into command line.

  23. if you’ve got enough time to install Gentoo, you have enough time to learn how to press the ‘i’ and the ‘esc’ key

  24. @Daniel Oliveira, nano isn’t bad, it’s actually a pretty capable editor. It’s just not extensible or “powerful” like emacs/vim. For quick edits it’s every bit as useful and much faster to load. Going against the pragmatic consensus here doesn’t make you look smart, it makes you look like a smug twat.

  25. This post provides solid reasons for having nano on the system as a fallback editor. It fails to address the question of why a basic vi implementation is not also included. (Vim is obviously bloatware, but most vi’s satisfy the criteria of being tiny and having few, if any, dependencies.) As others have pointed out, vi has been a standard tool on every Unix system for many decades, and it is required for Posix compliance.It seems like it would be sufficient to include the symbolic link to busybox, or have the install guide explain how to create this link. This would provide a basic, working vi without adding a single extra package. I’ve installed many a Gentoo, and never knew that trick. One extra sentence in the install guide would have saved me a lot of cursing about a basic Unix tool being unavailable.

  26. This is a bit late, but even in very late 2015 this is still valid. I love vim, but good luck with a newcommer to use it without any cheat sheet atleast. “To write, press i or insert first, at the bottom of the screen you will see “insert”. Press insert again to replace instead of adding. To save press escape, then : then w then enter. If you want to save and exit :wq … if you want to exit without saving then :q!” … Most will just give up right away…

  27. I absolutely agree that nano is the best choice for a default editor, even in 2016, even coming from a GNU Emacs junkie like me (yeah, I hate vi, sue me).Back in 2006, after trying out relatively “user friendly” variants of Linux like Mandrake, Red Hat, Debian, etc. and always ending up with an unstable desktop environment on multiple boxes, I decided to go with Gentoo. In my humble opinion, Gentoo Handbook is one of the most fundamental but at the same time easy to understand guide to tech newbies (like me back in the day) the basic concepts of the Linux/UNIX, like file system, mounting, boot-loader, init, networking, package management, etc. Learning all these concepts are difficult enough without the hassle of vi/emacs pain-in-the-arse, and I wouldn’t change nano to emacs even now after being a power-user for a while:Console editor -> nanoProgramming/general purpose editor -> GNU Emacs, Geany or Gedit/Pluma (depending on what I need)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.