Hacker News new | ask | show | jobs
by kstrauser 1878 days ago
Nano has/had some surprising defaults. Way back when, I was using nano to edit some file or another in /etc. When I wrote it out, it "helpfully" justified all the lines by inserting newlines to make them fit in 80 columns. My mentor looked at me disapprovingly, uninstalled nano, pointed me at `man vim`, and said "you're using this now. Thank me later."

Thank you, mentor.

I don't know if nano still has that as a default on any system that's shipped in the last 20 years, but I always give it the side-eye whenever a system has `EDITOR=nano` set and I run something like `visudo`. Am I about to break the entire system? Probably not, but to be sure I exit nano, configure `EDITOR=vim`, and try again. I know vim won't trick me like that.

3 comments

Switching to vim because you don't want to press ^L (or set the respective configuration option in .nanorc) to toggle off hardwrapping is a bit overkill though ...

It's not like "out of the box" vim is different in this regard. Half the time spent by a typical vim user with vim is coming up with personalised configurations.

Surely if I said I'm ditching vim for nano because I wanted columns hardwrapped at 80 characters by default you'd look at me funny, right? xD

It was more along the lines of "look, you've outgrown this tool, and it's time for you to move onto something more appropriate to the work you're doing". I'm not going to criticize anyone for using nano to edit the random file here or there (so long as using it doesn't break the file). But honestly, you reach the limits of nano's abilities fairly quickly. As fine as it is for a quick change to a file, Vim and Emacs other programming editors are popular for a reason. I surely wouldn't want to use it to work on large projects with lots of files.
Nano is now the default editor on Fedora since v33.

It makes sense. Modal editors have steep learning curves and were designed for an era of non-GUI interfaces running over teletypes. Everyone today knows how to use arrow keys to move around. Being dumped into vi, how many people will know how to go into the various modes to navigate and edit things?

I run OpenWRT on my router, nano is one of the first packages I install on it.

That was fixed in 2019. Apparently the default hardwrapping was inherited from pico, which was for composing email.

https://savannah.gnu.org/bugs/index.php?55067