News for hackers. Stuff that matters.
Re:GNU Nano 6.3 by Decabytes on Thursday April 28, 2022 @11:47AM (#31193990)
As an Emacs user I never really understood why Nano was so popular when you could use Emacs, but I've since learned a few things...

1. Emacs isn't always on all the systems, and getting it downloaded/setup can be a pain in the butt

2. Sometimes it's just easier to launch nano quickly to edit one line in a .bashrc from the command line

3. When I bork Emacs and it doesn't work, it's nice to be able to fall back on a simple editor to edit my .emacs.d

4. It's nice to have an alternative to vi with keybindings I'm more familiar with

Re:GNU Nano 6.3 by newswasboring on Thursday April 28, 2022 @12:39PM (#31194736)
Honestly the main reason seems to be that it looks less intimidating. Open vi and no help is offered in terms of commands, it's just an empty screen. Same for Emacs i think. Nano looks like something built for humans.
Re:GNU Nano 6.3 by soraminazuki on Thursday April 28, 2022 @02:17PM (#31196134)
This is the greeting text that is displayed when you launch Vim [1]:

    VIM - Vi IMproved
    
    version 8.2.4133
    by Bram Moolenaar et al.
    
    Vim is open source and freely distributable
    
    Help poor children in Uganda!
    type  :help iccf<Enter>       for information 
    
    type  :q<Enter>               to exit         
    type  :help<Enter>  or  <F1>  for on-line help
    type  :help version8<Enter>   for version info
    
    Running in Vi compatible mode
    type  :set nocp<Enter>        for Vim defaults
    type  :help cp-default<Enter> for info on this
"No help offered" or "just an empty screen" is not how I would describe the above text.

[1]: https://github.com/vim/vim/blob/a96edb736d4274fc4aea46080078...

Re:GNU Nano 6.3 by onei on Thursday April 28, 2022 @02:34PM (#31196395)
Most of the time I've seen people get stuck in vim is when they use "git commit" which opens up whatever you have $EDITOR set to. The default value in most distros I've used in vim/vi and I can't recall seeing usage help in that scenario.
Re:GNU Nano 6.3 by dEnigma on Thursday April 28, 2022 @03:09PM (#31196866)
I voiced my strong support when they changed the standard git editor on my distro from vim to nano. While I'm still playing with the thought of really getting into vim and/or emacs at some point, nano is just a much simpler, more familiar type of editor. Seems like a lot of other people also felt that way. Depending on your user base it might make sense to stick to vim though, in case you'd disappoint your more technical/unixy users.
Re:GNU Nano 6.3 by adamomada on Thursday April 28, 2022 @04:04PM (#31197528)
I’ve always had the idea that EDITOR should be on the same level as the login shell on nix systems. Choose your shell and your editor when creating your account, or don’t complain about the defaults
Re:GNU Nano 6.3 by Anthony-G on Thursday April 28, 2022 @04:29PM (#31197811)
I agree but I’ve found that a lot of users don’t know they can set EDITOR in their shell profile – or that the `chsh` command exists to let them change their login shell.
Re:GNU Nano 6.3 by adamomada on Thursday April 28, 2022 @04:41PM (#31197951)
Yeah the “create your account” part of the install should expose a few more settings such as the above, or perhaps a more generic “user account settings” pane in the major DEs to show the most common environment configurations for user accounts
Re:GNU Nano 6.3 by onei on Thursday April 28, 2022 @06:01PM (#31198743)
I am one of those that didn't know chsh was a thing - thanks for the tip!
Re:GNU Nano 6.3 by soraminazuki on Thursday April 28, 2022 @02:54PM (#31196673)
True, but at least it points you to the :help command at the beginning of its man page and pressing ctrl-c tells you how you can quit.
Re:GNU Nano 6.3 by alpaca128 on Thursday April 28, 2022 @04:38PM (#31197924)
As a Vim user I agree. People who don't know about this environment variable might also not be very familiar with Vim. It helps nobody to surprise people like that.

Also I like to use Vim's terminal buffer, and it turns out accidentally starting Vim inside Vim rarely leads to satisfying results.

Re:GNU Nano 6.3 by AlchemistCamp on Thursday April 28, 2022 @03:08PM (#31196846)
What distros do you use? One of my ongoing irritations with Ubuntu is that the default editor is not VIM.
Re:GNU Nano 6.3 by onei on Thursday April 28, 2022 @05:59PM (#31198732)
Y'know, now that you mention it, I don't recall changing the default editor in Ubuntu. I think I first noticed vi or vim as the default editor in Fedora around 6 years ago, and maybe also in git bash on Windows. Beyond that, my memory is hazy, but I think vi or vim is the default in Debian and RHEL/CentOS, but I wouldn't put money on it.
Re:GNU Nano 6.3 by kevin_thibedeau on Thursday April 28, 2022 @03:54PM (#31197402)
Just change it to what you want.
Re:GNU Nano 6.3 by AlchemistCamp on Thursday April 28, 2022 @06:22PM (#31198945)
I do... every time :)
Re:GNU Nano 6.3 by vimacs2 on Thursday April 28, 2022 @02:32PM (#31196361)
OP was specifically referencing vi, not vim
Re:GNU Nano 6.3 by marssaxman on Friday April 29, 2022 @06:33PM (#31211383)
I have ended up in vim by accident on quite a number of occasions over the last few decades, but I have never seen the quoted text. Perhaps it is something you only see if you are trying to use vim on purpose?
Re:GNU Nano 6.3 by bc4m on Thursday April 28, 2022 @03:11PM (#31196897)
The Emacs welcome screen links to a tutorial, a guided tour, and manual, all of which are inside Emacs. I would say its help functionality is potentially its greatest strength.
Re:GNU Nano 6.3 by newswasboring on Thursday April 28, 2022 @11:33PM (#31201093)
Right, but when nano first opened for me, I didn't need a help or manual. That's what I mean by it feeling like it was made for humans.
Re:GNU Nano 6.3 by codedokode on Thursday April 28, 2022 @01:53PM (#31195782)
I use nano when I need to edit something from CLI because I don't like ancient editors with modes or non-standard key combinations from 80s. And in nano the most important shortcuts are at least written in the bottom of screen.

While nano supports some standard shortcuts (arrows, Ctrl + arrows, Home, End, PgUp, PgDn), others are non-standard and I don't understand why. For example, "save" is Ctrl + O instead of common Ctrl + S, exit is "Ctrl + X" instead of "Ctrl + Q", Esc doesn't work when you want to cancel search, and so on. What a nonsense. Why should someone use different shortcuts for the same function.

Re:GNU Nano 6.3 by soraminazuki on Thursday April 28, 2022 @03:21PM (#31197004)
It's not a good idea to use Ctrl + s and Ctrl + q as default keybindings for any important functionality on the terminal because terminals traditionally used them to stop/resume terminal output. Some terminal emulators still do this, so making people press those keys unwittingly would be problematic. So no, nano developers aren't being non-sensical here.
Re:GNU Nano 6.3 by adhesive_wombat on Thursday April 28, 2022 @03:39PM (#31197243)
Yep, pressing Ctrl-S in a terminal and having it freeze up is extremely confusing at the best of times. Because I often (used to) press Ctrl-S as a reflex against certain crashy software, I'd not even really recall pressing it and then I'd wonder what the hell was going on.

Then again, I have saved :wq into a few text files too!

Re:GNU Nano 6.3 by cesarb on Thursday April 28, 2022 @03:51PM (#31197374)
> Yep, pressing Ctrl-S in a terminal and having it freeze up is extremely confusing at the best of times.

At least some terminals (IIRC, KDE's Konsole is one of them) show a helpful colored bar telling you that the output is paused and you should press Ctrl-Q to resume. Unfortunately, other popular terminals (like Gnome's gnome-terminal) don't have any visible indication for that.

Re:GNU Nano 6.3 by gnubison on Thursday April 28, 2022 @06:01PM (#31198749)
‘stty -ixon’ disables this.
Re:GNU Nano 6.3 by klyrs on Thursday April 28, 2022 @03:08PM (#31196848)
This made me chuckle. Pico was the first non-BASIC editor I used because the public library BBS used Pine. As a descendant of Pico, I'd say that Nano is an ancient editor, and it comes with all the historical baggage fueling your complaints.
Re:GNU Nano 6.3 by gnubison on Thursday April 28, 2022 @06:00PM (#31198740)
Actually, ^S does save, since 2017.
Re:GNU Nano 6.3 by currysausage on Friday April 29, 2022 @06:58AM (#31203637)
But you might have to put "stty -ixon" inside your .bashrc (or does nano take care of this?).
Re:GNU Nano 6.3 by gnubison on Sunday May 01, 2022 @12:59PM (#31226573)
Nano takes care of this, just like it disables line buffering (ICANON) and signal keys (ISIG).
Re:GNU Nano 6.3 by NelsonMinar on Thursday April 28, 2022 @12:20PM (#31194465)
Back in the 90s the joke was "Eight Megabytes And Constantly Swapping". 8mb is nothing now and I note that Nano, with no file open, is 6768kb virtual and 3620kb resident on my x86_64 Linux box.

(I use mg as my small emacs alternative; full emacs UI but tiny binary / memory. Unfortunately it doesn't support Unicode properly.)

Re:GNU Nano 6.3 by soraminazuki on Thursday April 28, 2022 @02:44PM (#31196544)
Modern operating systems and memory allocation techniques make it hard to account for memory usage in a meaningful manner without a more in-depth investigation of program behavior. Quick stats from memory reporting tools aren't worth much in isolation unless those numbers significantly deviate from expectations.
Re:GNU Nano 6.3 by xxpor on Thursday April 28, 2022 @02:43PM (#31196523)
I wonder how much of the base data structures that are always in memory are pointers, and if it'd be more fair to say it's really the equivalent of 3 mb virtual/1.5 mb resident (or even 1.5/.75 for 16 bit!)
Re:GNU Nano 6.3 by anthk on Thursday April 28, 2022 @12:30PM (#31194630)
Check jmacs from joe.
Re:GNU Nano 6.3 by NelsonMinar on Thursday April 28, 2022 @12:48PM (#31194850)
Oh that's nice, somehow I never thought to try Joe. It's 13MB VSZ and 7MB RSS megabytes in my little measurement. emacs-nox is 94/22.
Re:GNU Nano 6.3 by anthk on Thursday April 28, 2022 @01:54PM (#31195793)
"emacs -nw -q" can be pretty fast too.

Not light on resources compared to jmacs, but at least it loads faster.

Re:GNU Nano 6.3 by microtherion on Thursday April 28, 2022 @04:11PM (#31197618)
There is also GNU zile.
Re:GNU Nano 6.3 by a_e_k on Thursday April 28, 2022 @04:52PM (#31198052)
Or Mg, which is even smaller.
Re:GNU Nano 6.3 by anthk on Thursday April 28, 2022 @05:14PM (#31198302)
The parent had issues with Unicode, which jmacs doesn't.
Re:GNU Nano 6.3 by NelsonMinar on Friday April 29, 2022 @05:40PM (#31210864)
Does not support Unicode.
Re:GNU Nano 6.3 by zdkl on Thursday April 28, 2022 @12:15PM (#31194380)
> I never really understood why Nano was so popular when you could use Emacs

> When I bork Emacs and it doesn't work

Only 50 % joking but like you said it's not if, it's when. Nano is there and works.

Re:GNU Nano 6.3 by avgcorrection on Thursday April 28, 2022 @12:20PM (#31194463)
`emacs --quick`?
Re:GNU Nano 6.3 by anthk on Thursday April 28, 2022 @12:30PM (#31194623)
emacs -q
Re:GNU Nano 6.3 by distantsounds on Thursday April 28, 2022 @12:31PM (#31194638)
Nano is _by far_ easier to use as a first-timer on the command line. Emacs is an amalgamation of a scripting language that happens to have a text editor built in.
Re:GNU Nano 6.3 by eixiepia on Thursday April 28, 2022 @12:04PM (#31194238)
5. Sometimes you don't need an operating system, but a decent editor and that's where Nano come in :)
Re:GNU Nano 6.3 by yaantc on Thursday April 28, 2022 @01:21PM (#31195285)
I used to use jed instead of nano for quick edits, but same idea really. Then one day I realized that "emacs -nw -Q" starts subjectively instantly, and is also immune to a borked configuration ("-Q" skips it). So I just created a short alias for it and use it. Bonus: one can always load all the configuration later if needed.

That doesn't solve point 1 obviously, but then that's never been an issue for me: emacs is always where I need it, and then there's always TRAMP.

Re:GNU Nano 6.3 by throwawayboise on Thursday April 28, 2022 @05:10PM (#31198257)
> Emacs isn't always on all the systems

Nor is nano.

vi is about the only editor that can be assumed to be available on a unix-like system.

Re:GNU Nano 6.3 by progre on Friday April 29, 2022 @12:01AM (#31201277)
Ed is the standard editor
Re:GNU Nano 6.3 by brimble on Thursday April 28, 2022 @02:44PM (#31196545)
An editor with always-on help displaying the most common actions one might want to perform, is super-useful not just for n00bs, but for anyone who doesn't work on the command line enough to memorize the commands to operate vim and emacs.

Crucially, you don't have to ask nano for help. It helps by default.