Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
GNU Nano 8 comes with modern key bindings (nano-editor.org)
85 points by smartmic on May 31, 2024 | hide | past | favorite | 35 comments


I really love nano. It's so cool to have an easy to use fast and reliable code editor with just a bit more than basic functions. I often see it dismissed as too basic while in reality with a minimal amount of configuration nano supports syntax coloration, line numbering, automatic indentation, the mouse to position the cursor, scroll, and to activate command (by clicking on them in the bottom help), theme customisation, multiple files opening, keyboard macros, and a few more other things that doesn't come to my mind right now. It can actually go a long way before you actually need something more powerful :).


Is there any reason to use nano over vim other than learning curve?

If nano ever gets run for some reason (e.g. I forgot to set EDITOR) I immediately quit and launch vim.

I readily admit nano is easier for beginners to get something done, but I don't see any value in it if you already know vim enough for basic edits.


The simple answer is "no", in the same way there's no need to write a python script if you really like java.

For a non-trolling answer though, for me iy's the ease with which nano's macros can be used and the easy syntax highlighting.

Not long ago, I wanted to create syntax highlighting to support my own format in nano and vim. The nano one took me 5 minutes. The vim one took me 2 days.


> Is there any reason to use nano over vim other than learning curve?

A simple matter of preference, I guess :).


This seems like as good a place as any to post the PSA that even on the current version of nano, ^s does a silent save to the current file (as opposed to the "Write Out" ^w which is like a Save As...) Why on earth this one doesn't merit inclusion in the command bar is beyond me.


Probably because some terminals interpret Ctrl+S as a "pause the terminal" command and if you don't know about it, it looks like your editor has frozen.


Welp, this is big enough to make Nano my default editor. While it'll take a while to become "ubiquitous" (as in version 8.0+) it's trivial enough to build for any systems I manage.

The new mousewheel behavior is particularly nice. It's totally up to my taste with --modernbindings and --mouse.


Now if they add an edit.com-style menu at the top I’ll really never need another CLI text editor.


I wouldn't complain for sure. I always loved edit.com and have such fond memories of it.

I used mcedit as terminal text editor for a while, but it was never installed anywhere but at home, so ended up defaulting to vi and nano for consistency. If nano became a bit more like edit.com that'd mean it'd be almost everywhere by default once versions catch up...one can dream.


is there a "unix/Linux" cli text editor that replicates or approximates EDIT? I have used micro a lot, but it's a spiritual cousin of nano/pico of course. Curious what others who like editors that are nothing like Vim use. (besides emacs, which as someone who doesn't know lisp, is probably wasted on me)



mcedit is the closest one in general look and feel. It's installed together with Midnight Commander. Of course it can be used as an independent editor.

EDIT:Sibling post proved me wrong, Tilde also exists. How interesting.


(edit.com as in the old msdos editor, not as in some new web thing)


Great move. I'm not a fan of emacs nor vim complexity.


Nano comes from pico which in turn comes from the email client pine (which is currently forked as alpine).

alpine isn't used much anymore (although I still use it) but it's progeny is still widely used, which is nice.


Oh, wow! This was one of the reasons I wrote my own editor, years ago - I liked nano and used it frequently, but preferred conventional GUI-style control-key bindings.


I'm genuinely intrigued, what made you decide to write your own editor instead of patching the keybindings in nano?


Don't even need patching. Could've CUA keybindings by entering them in the rc file.

  bind ^X cut main
  bind ^C copytext main
  bind ^V uncut main
  bind ^Z undo main
  bind ^Y redo main
  ...
(Those are from an old rc that had around. The copytext/uncut have been renamed in newer versions.)


It blows my mind that this wasn’t more widely publicized over the years. At least this is the first time I’ve seen it, and I learned vim a long time ago. Partly because if it was a choice between weird keys, may as well learn vim.


It blows my mind how many people need directed at the included documentation or config files.

Sheep to slaughter. Before anyone judges me for judging, instructions-included is pretty consistent across disciplines.

I'm not a mechanic but I can figure out routine maintenance/customization.

I'm surprised you, and surely others, arrived at switching editors instead of changing the editor itself. Not in the source or with compilation. The configuration.

I know you say partly, I just doubt there is any perfect editor. All roads lead to configuration.


They're even in the default global config, just commented out at the bottom


That was only one of the reasons. The keybindings were the seed of the idea, but as soon I started thinking about what I would like to change, I realized that I also wanted multiple edit buffers and a directory browser. Essentially it's my all-in-one coding environment.


FWIW, nano can have multiple edit buffer, just add "set multibuffer" in your .nanorc to activate this feature :).


Seriously!? I had no idea. What an underappreciated bit of software nano is.


This is great! I used to install micro[0] as "nano with better shortcuts", but it was always a bit of an overkill, so I'm really happy with this change.

One quirk that remains: even with --modernbindings, Ctrl+X and Ctrl+C will add to nano's clipboard, instead of replacing whatever is there.

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


This is not a bug, this is a feature. One of nano's best in fact.

What you say is not true except in the case of consecutive cuts. So this is a way of cutting multiple consecutive lines without requiring a visual selection.

If you don't want that just move the cursor once before the second cut.


I don't see an option to set that in nanorc

https://www.nano-editor.org/dist/latest/nanorc.5.html

And mouse mode requires holding shift to select text. Guess I'm sticking with micro.


Oh my, I have nano as my default GIT_EDITOR. Will stay with the old defaults definitely.


I don't know why people gripe so much about the default keybindings. I used them for like 3 days before realisimg they are easy and make sense.

I'm now in the reverse situation; these "modern" keybindings feel really clunky to me.


Wasn't nano released after the CUA spec? Hardly seems correct calling these "modern" keybinds


I had t realized nano had progressed beyond being a pico clone. Happy to see that.


Great change! I really hate to remember different key bindings crossing editors.


Finally, this was probably my biggest gripe with it.


Now if only they could enable cua-mode by default in Emacs.


I think you can tell init not to allow any mode to launch cua-mode by default.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: