Readit News logoReadit News
its_notjack · 2 months ago
I must have used nano for years at this point, and I'm shocked to find out how customisable nano actually is! I tend to use micro[0] on most of my systems now just because it comes with really lovely defaults and keybindings that are a bit more familiar, but this might make me take a second look at nano in future.

[0] https://micro-editor.github.io/

tpoacher · 2 months ago
It's not just customisable, it's also insanely scriptable. Any action that you can do in nano itself corresponds to a command, and you can create "string macros" that you can bind to key combinations. Additionally it can execute external commands on any nano buffer and return the result. Combining the two is very powerful.

E.g. I have a configuration which allows me to use nano while editing pdf side-by-side, and be able to click on the pdf and land in the correct line in nano, and vice-versa. (and obviously compiling the latex document itself happens via a custom keystroke).

ssivark · 2 months ago
Interesting. Since this kind of scriptable customization sounds like bread & butter emacs -- what tips the scales towards nano, for you?
digisign · 2 months ago
Before I used micro & ne I used nano, and configured the keybindings to work in the CUA style. I still have the dot files, didn't delete them, but they rarely get used anymore.

I think they recently added Ctrl+S to save by default, even if unconfigured, woohoo.

jval43 · 2 months ago
I knew it! A junior dev recently used CTRL-S in nano and I couldn't believe that it actually worked.

They told me it had always been this way and I felt stupid for a bit. Good to know it's a recent addition.

smartmic · 2 months ago
For CUA aficionados, I recommend dte[0]. It has replaced my nano usage quite a lot.

[0]: https://craigbarnes.gitlab.io/dte/index.html

genpfault · 2 months ago
> Ctrl+S to save

XOFF ignored, mumble mumble

flkiwi · 2 months ago
Same same. Never even occurred to me to look. That's the risk of a (successful) low-friction product though: you use it in quick bursts where the tool is necessary but largely invisible, and you never invest in learning more about it because it works so well with the defaults. There's probably a profound strategic insight buried in there somewhere.
chawyehsu · 2 months ago
It seems few people are aware of how customizable nano actually is. Usually, they use nano with the default preset for quick bootstrapping tasks and then switch to vim without hesitation. While vim/neovim are certainly very powerful, nano remains my go-to editor for many quick terminal operations. I've customized it quite a bit[1], especially the key bindings, though the defaults are already excellent.

[1]: https://github.com/chawyehsu/dotfiles/blob/main/.config/nano...

davidcollantes · 2 months ago
I would dearly love it if you could comment a little bit more that nanorc. I am going to “steal” some of it, for sure. Thank you much for sharing it!
p4bl0 · 2 months ago
I tried a long time ago [1,2] to initiate this discussion on Nano here. I'm glad it's happening :).

[1] https://news.ycombinator.com/item?id=41289141

[2] https://news.ycombinator.com/item?id=41289773

sanex · 2 months ago
Nano is my go-to whenever doing something quick in the terminal. It's quick, I don't need to learn how to use it, and now it's going to be slightly more convenient. I had no idea it had these options. Thank you!
bigstrat2003 · 2 months ago
Nano is by far the best terminal editor imo. The only situation where I'm using a terminal editor is when I'm ssh'ed into a server, and I need to quick edit a file (for serious code writing a GUI editor is far more capable). Nano is ideal for that use case: you get in, it tells you what all the relevant keybinds are right on the screen, and you get out without any fuss.
gorgoiler · 2 months ago
Nano is quite a venerable piece of software with the initial implementation shipping as pico, the text editor for the pine mail client, back in 1992. Tens of thousands of students at a few universities will have been introduced to it as their very first email client.

The pine authors fell foul of the Debian free software guidelines and, as well as nano, a clone for the mail client itself lives on to this day as alpine. I use it every so often for a spot of nostalgia.

bombcar · 2 months ago
This is exactly my path to it, and even though I know how to “eat flaming death” vi and used emacs for awhile, nano is still my default “edit that config file quickly”.
Firehawke · 2 months ago
Same. My first internet access was a BSD shell account back in 1993; I had Pine and Pico on there. Coming from a world of MS-DOS BBSes (I ran one myself!) it wasn't that hard to take QEdit skills and move that over to using Pine and Pico-- it was quite comfortable.

I still tend to muscle memory my way through using Nano when I need to do quick file edits on Linux.

iLoveOncall · 2 months ago
If you're on Mac and can't get .nanorc to work, check out https://stackoverflow.com/a/73373788/3876196

It's also possible that you simply do NOT have nano installed at all, and just have the simlink from nano to pico by default. That was my case. In this situation, install nano and it should work.

positron26 · 2 months ago
Right after the nano maintainer got bullied out by the FSF, I noticed two bindings got their defaults changed. They never change. I almost feel like it was graffiti, a flex against the old maintainer, a retribution for not doing whatever the FSF wanted.

Since forever, GNU readline programs and nano had identical bindings. I'm fast moving around the CLI because I'm fast at nano. Emacs has the same defaults. What sane organization only abandons their own defaults and prioritizes that work after pushing the existing maintainer out (or irritating them enough to accomplish this)?

kstrauser · 2 months ago
Which bindings changed?
positron26 · 2 months ago
bind ^F forward main

bind ^B back main

bind M-f nextword main

bind M-b prevword main

jasperry · 2 months ago
The line numbers and position bar are some real quality-of-life enhancements!

I don't regularly use nano anymore, but I have often thought that more programs should imitate the way it shows the command shortcuts on-screen as a kind of instant tutorial. I remember my physics major friends in college thinking it was pure snobbery for vi not to do that by default. Back then we were dialing in to an HP-UX server and using pico, which nano is an open-source clone of. For those who aren't aware, pico was originally the editor component of the Pine email client.

mystifyingpoi · 2 months ago
> physics major friends in college thinking it was pure snobbery for vi

I don't think it is snobbery, that approach would clutter the entire screen. Basically every single small/capital letter and symbol has a function in vim.

jasperry · 2 months ago
To its credit, vim does show a help text with :q on it if you start it with no file. Back then, it was just vi opening to a blank screen.
ziotom78 · 2 months ago
Absolutely, the shortcut help is so useful!

I believe that Nano and Pico copied it from Wordstar.

Firehawke · 2 months ago
That seems very likely. One of the first things I'd noticed back in the early 90s when I got my shell account and used Pico for the first time was that the UI was similar (not exact copy, mind you) of how Wordstar was, with some basic guidance at the bottom to get you started.

Also kind of reminds me of the old Telix terminal software for MS-DOS, with the bottom status bar. Not exactly the same, but again quite similar in the approach to have you just quick glance at the bottom of your screen for a HUD.