Hacker News new | ask | show | jobs
by geuszb 2643 days ago
I'm sure nano/pico and the like are nice but to me there's two things a terminal editor can try to solve for: being nice, or bring ubiquitous. The nicest ones (say emacs) are way nicer than nano in terms of features, extensibility, etc. Now for being ubiquitous, nothing beats vi to date. I can't tell what nano is aiming for?

EDIT

I guess I had assumed that vi/vim was significantly more widespread than nano. Maybe that's an outdated assumption? I feel like I've come across a few instances where vi has been the only choice...

9 comments

Nano is somewhat ubiquitous in that it's the default editor on many Linux distros, including both Debian and Ubuntu. I often run "crontab -e" or "git commit" and end up in nano because I forgot to set $EDITOR on a new Linux box.

Edit: I suspect it's the default because it launches with visible instructions on how to exit. Launching Vim or Emacs strands a lot of new users.

Indeed. Never underestimate how important exiting is: https://stackoverflow.blog/2017/05/23/stack-overflow-helping...
I use nano because I don't have to remember anything to use it. If you put me in front of nano I can open a config file, go to the line I need, edit in something, save it, and exit without knowing a single thing about nano. If you put me in front of emacs or vi I have absolutely no idea what I'm looking at.

I am sure vi and emacs are much powerful than nano, but the time I'd have to invest in learning them would outweigh the benefit. I just don't edit text files enough for it to pay off.

It seems like nano has started to reach vi-like levels of ubiquity. Every fresh Debian install annoys me by dropping me into nano as the default editor at some point (until I update-alternatives and point it at vim.tiny).

The edge still goes to vi, especially if you log into older/legacy things, or in very resource constricted environments. It looks like busybox, for instance, has a vi but not a nano: https://busybox.net/BusyBox.html

Legacy, more than anything else. Nano has been a thing for decades, and it will likely be a thing for decades more.

Are there better, more powerful editors out there? Sure. But just like vim, you can expect to find nano pretty much anywhere, and if you need to make a quick change, say to a configuration file on a bare-bones system, that's nice.

Of those two (nano/vim), I've also found it easier to introduce people to nano. I personally use vim, but if I'm doing a tutorial for people who aren't very familiar with the unix terminal, and at some point in the tutorial they need to edit a config file, I'd rather not take a big digression into explaining vi's modal-editing concept just to change one line in a config file.
You're assuming Linux. BSD distributions don't install nano by default. vi is a mandatory POSIX utility, nano is not.
This doesn't help the problem of knowing what to type on any system up-front, but fwiw, FreeBSD ships with a nano-like editor in the base install, ee(1).
And what about any of the other BSD? Or Solaris? Might as well bite the bullet and learn some basic POSIX vi (or ed).
The majority of the population can load nano and start using it with almost no training. Not so for vi.
Why nano? nano is sane.

With Emacs/VI you need to bring a HUGE mental framework to just use it.

And maybe, with luck or some years of pain training, to just EXIT it :)

---

Vim/emacs are powerful. Nice? Never. Easy? never. Good for most common editing task in the terminal?. Nope.

Claim that Vim/Emacs are good is like say "why people use Sublime Text when Eclipse is so much better?"

Except, with eclipse, you know how exit it.

Vi's not too bad. 'i' to edit text. ESC to get out of editing. ':w" to save changes. ":q" to quit. ":wq" to do both. ":q!" to quit without saving. "hjkl" for navigation in case the arrow keys don't work.

That's enough to get by for quick edits. I haven't used vi a ton in my life, but I've managed to remember that much.

Yeah, but you NEED TO KNOW THAT before use it.

With nano, all is straight in the UI. That is powerful, and so obvious.

Why Vim/Emacs not have that?

Emacs comes with extensive built in documentation. At the bottom it says hit C-h C-a which takes you to an about page which has various help links.

The GUI app as a menu bar, a standard gui feature that includes at the far right an entry entitled HELP under which one can find a manual, docs, a tutorial, a FAQ and various other options.

I definitely agree with you that nano is more intuitive and certainly much more beginner-friendly.

Just saying that vi at its most basic level isn't bad at all. The user only has to remember i,esc,:w,:q,:q! for basic editing. That's not much.

But I do agree that it would be nice if vi / vim would simply list those commands when starting the editor for those who have never used it or haven't used it in ages.

Indeed, nano's interface is easily discoverable. Vi(m) gives some hints, and emacs... the tutorial is kinda amazing but takes hours to get through. I can't really imagine a discoverable interface for vim that doesn't take up tons of real estate -- so the alternative is a cheat sheet tacked up next to your monitor
Vim is how much you want to get out of it. I looked at Vim, thought about its value proposition, and decided only to learn the most basic commands from a cheat sheet. That makes it more productive than Nano already.

I know other people who aren't Vim fanatics at all but have occasional work in the terminal, and they too also just learned the most basic Vim commands and have the most basic Vim configurations, if at all.

I don't disagree with you at all and my reply should not be construed as criticism, but I just want to point out how funny the line, "Vim is how much you want to get out of it," is.
Nano is perfect for the casual terminal user, it does its job fine when editing an apache server config file once in a while. But when working on the terminal all day, there's no way around vim, IMO. It's good to memorize some basics (save, quit, search & replace) of vim, because there's always a system where only vi is installed (e.g. ESXi).
vim if you open it without a file has a little blurb that includes common operations like exiting. Hitting Control+c the common hotkey to kill a terminal app in any vim buffer tells you how to exit. Control+z puts it in the background.
emacs is a significantly larger installation (disk) than nano, taking longer to install and more system resources consumed. If I'm jumping into a small VPS to tweak something, or auto-installing an editor in every docker container, nano wins over emacs.

As a developer who almost exclusively uses GUI editors (Sublime / IntelliJ) I have lost the emacs skills I gained in college, and I don't use emacs enough to remember the key strokes necessary to make it more useful than nano. It's more difficult than nano because I have to google a cheat-sheet every time I use emacs.

I never liked vim.

Nano is a great terminal editor, has enough commands to make me productive when needed, and I use it exclusively for terminal text editing.

Being the Venn diagram part of nice AND ubiquitous. Duh!
Vi is ubiquitous. Vim is not.
Nope. vi almost doesn't exist. Most distros just use vim in a vi mode (or vim.tiny, same thing).

Just because the command is "vi" to invoke doesn't mean anything.

"vi almost doesn't exist"

I agree, but if anyone is curious, the source is available and has a BSD style license: http://ex-vi.sourceforge.net

Not on the supercomputer clusters I used to use. You're confusing user-centric desktop distros with the tiny userlands available in production systems.

Also, do Macs come with vim?

Ah yes sorry fixed that