News for hackers. Stuff that matters.
Re:Nano 5.7 by fouric on Thursday April 29, 2021 @10:56AM (#26981972)
As a vim and emacs user, I don't give nano any hate.

I'm surprised when programmers use it, sure, but that's because if my profession was going to require editing text files for hours a day (which it does), I would be happy to trade a steeper learning curve now for a less unpleasant job experience later.

I totally understand why non-programmers don't use it. If your job does not involve you editing text files for hours a day, then nano (or a graphical editor - gedit, kedit, notepad?) is inarguably a better choice for you than emacs or vim - the effort involved will probably never pay off.

ed users: you have my respect, which I will dispense from a distance.

Re:Nano 5.7 by umvi on Thursday April 29, 2021 @01:53PM (#26984239)
Linus Torvalds said he might switch to nano for his daily driver[0]

>[Text editing is] all done in a traditional terminal, although I don't use 'vi'. I use this abomination called "micro-emacs", which has absolutely nothing to do with GNU emacs except that some of the key bindings are similar. I got used to it at the University of Helsinki when I was a wee lad, and I've not been able to wean myself from it, although I suspect I will have to soon enough. I hacked up (a very limited) utf-8 support for it a few years ago, but it's really showing its age, and showing all the signs of having been written in the 80's and the version I use was a fork that hasn't been maintained since the mid 90's.

> University of Helsinki used it because it worked on DOS, VAX/VMS and Unix, which is why I got introduced to it. And now my fingers are hardcoded for it. I really need to switch over to something that is actually maintained and does utf-8 properly. Probably 'nano'. But my hacked-up piece of historical garbage works just barely well enough that I've never been really forced to teach my old fingers new tricks.

[0] https://www.tag1consulting.com/blog/interview-linus-torvalds...

Re:Nano 5.7 by emondi on Thursday April 29, 2021 @02:50PM (#26984949)
Wouldn't modifying some GNU emacs shortcuts to his liking be easier than mantaining that editor?
Re:Nano 5.7 by powersnail on Thursday April 29, 2021 @06:56PM (#26987855)
Productive people are just lazy in a different way.
Re:Nano 5.7 by reidrac on Thursday April 29, 2021 @02:12PM (#26984435)
I used joe for a while, basically because it was installed at the Uni's labs (and because I had used WordStar on DOS). vi (or vim, can't remeber) was misconfigured with terrible defaults, so basically I got used to joe.

It was very hard to force myself to stop using it and learn vi!

Re:Nano 5.7 by kdtsh on Saturday May 01, 2021 @12:37AM (#27003160)
One of my colleagues is a old Unix hacker (one of my favourite things to do is get him ranting about his least favourite OS of all time, HP-UX 8.x). I have wondered before what editor he uses, and once when I peeked over his shoulder I saw that it was MicroEMACS. At the time I thought it might be a neat GNU Emacs clone with a smaller footprint, but no, it’s nothing of the kind. Old habits die hard.
Re:Nano 5.7 by Ekaros on Thursday April 29, 2021 @11:55AM (#26982782)
I personally prefer nano over vi, ed or emacs. But when I do some programming or bigger work I use proper IDE like Visual Studio Code or Eclipse.

It's decent enough for times when you want to do something quick on cli. And then spend rest of the time with graphical IDEs...

Re:Nano 5.7 by kijin on Thursday April 29, 2021 @12:44PM (#26983415)
Same here. I like nano because it's a simple and intuitive editor that doesn't do much (though it does have some surprisingly powerful features once you know the shortcuts). I already have a full-blown IDE running on another screen and I don't want to spend any energy trying to stay on top of another one.

In other words, I would not use nano as my primary editor, but it's perfect as a secondary. If I need to edit more than a few lines, I'll just load up the file on my usual IDE.

Re:Nano 5.7 by noir_lord on Thursday April 29, 2021 @12:30PM (#26983216)
Same - I use nano for quick edits on remote boxes or locally but for programming I use intellij.

I totally get why people use vim (and emacs) in fact I use vim for one specific thing I can not do in intellij (highlight closing parens in docblocks - intellij doesn't do it and if you are writing annotations it's a major pita that it doesnt).

Re:Nano 5.7 by Avery3R on Thursday April 29, 2021 @02:19PM (#26984526)
I wouldn't call vs code an IDE, it's closer to a text editor
Re:Nano 5.7 by potta_coffee on Thursday April 29, 2021 @02:55PM (#26985006)
VSCode has intellisense, debugger, console, etc. It definitely fills a niche between a text editor and an IDE, IMO.
Re:Nano 5.7 by robsonhn on Thursday April 29, 2021 @05:54PM (#26987307)
So does vim though. I use on vim the same language servers as VSCode.
Re:Nano 5.7 by PandawanFr on Thursday April 29, 2021 @02:43PM (#26984851)
With all the extensions available, you can get pretty close to a full IDE
Re:Nano 5.7 by tpoacher on Thursday April 29, 2021 @02:08PM (#26984401)
I think your opinion simply reflects a degree of ignorance of nano's actual capabilities, rather than a genuine surprise at human behaviour. If anything, your comparison to gedit/notepad (notepad??? seriously???) makes that much clear.

Honestly I don't mind vim, but I prefer nano. And I spend 24/7 coding in my terminal. Nano covers all my needs and then some.

And while you should absolutely not switch vim to nano if you enjoy vim, I would totally encourage you to play around with nano a bit more. You may be positively surprised at what you find.

Re:Nano 5.7 by sedeki on Thursday April 29, 2021 @05:26PM (#26986991)
Just to be clear: are you coding in nano all the time in that 24/7 terminal session? But there is no syntax highlightning etc? To edit config files, sure. But most of the time spent?

I prefer nano too; trying to learn vim. But my coding happens in either Qt Creator or VS Code.

Re:Nano 5.7 by skneko on Thursday April 29, 2021 @06:25PM (#26987557)
Nano has syntax highlighting...
Re:Nano 5.7 by sedeki on Thursday April 29, 2021 @06:42PM (#26987703)
You're right, sorry.
Re:Nano 5.7 by zitterbewegung on Thursday April 29, 2021 @11:04AM (#26982085)
Its more like using the right tool for what you actually want to do.

0. Use cat and output to a file to really quickly make a new file from your clipboard or from the web

1. Nano is great for editing config / text files quickly and the learning curve is really low due to a more modern design.

2. vim can be reliably found everywhere on nearly any unix machine but the learning curve is much higher initial learning curve vim has more customization than vi and has basically replaced vi on modern installations of unix

3. emacs has out of the box has a learning curve less than vi but can't be found everywhere and you probably have to install it but it also has a large amount of extendability. the initial learning curve is a bit low but then it gets higher and higher. It also has multiple versions and a GUI and a package manager.

Re:Nano 5.7 by bityard on Thursday April 29, 2021 @11:09AM (#26982155)
> due to a more modern design

nano is a clone of pico, the text editor for the pine email client, so "modern" is definitely a matter of some interpretation here. :)

Re:Nano 5.7 by gbear605 on Thursday April 29, 2021 @11:34AM (#26982498)
It’s more similar to modern text editors, but yes it’s definitely more of a precursor
Re:Nano 5.7 by ch_123 on Thursday April 29, 2021 @01:21PM (#26983911)
As someone who has invested time into vim, I can edit text files with it much quicker than I could with nano. I also suspect someone with sufficient nano experience may be as capable of coding in nano as I am in vim.

"Use the right tool for the job" is all well and good (I mean, who wants to use the _wrong_ tool for a job?) but can lead to false dichotomies around tools which are designed to solve the same fundamental problems/use cases. I would posit that the model you suggest only is applicable to people with limited experience with vim, nano (and/or emacs). I would generally recommend that someone picks one and runs with it.

Re:Nano 5.7 by fouric on Thursday April 29, 2021 @12:52PM (#26983546)
> Nano is great for editing config / text files quickly

emacsclient makes it just as easy to edit a text file extremely quickly with Emacs as to open a new vim or nano in place.

> emacs [...] initial learning curve is a bit low but then it gets higher and higher

Emacs's difficulty is, for simple editing cases that you could use nano for, only a little bit more difficult than nano, and certainly easier than vim - no modal editing, and you can learn the essential shortcuts (save, undo, open, close) in very little time.

I don't agree that the learning curve increases - more complex things require that you learn more about Emacs, sure, but my experience has been that it's about as easy to go from beginner to intermediate Vim knowledge as it is in Emacs, if not slightly easier due to the latter's better design and documentation.

> emacs [...] can't be found everywhere

TRAMP has been around for two decades now, making this largely irrelevant - https://news.ycombinator.com/item?id=26982916

Re:Nano 5.7 by blueblob on Thursday April 29, 2021 @11:03AM (#26982081)
Yeah, how could you hate on anyone who uses the standard text editor?[0]

[0] https://www.gnu.org/fun/jokes/ed-msg.html

Re:Nano 5.7 by xfer on Thursday April 29, 2021 @12:41PM (#26983370)
This is what i used to edit configurations in plan9 console if you don't have graphics support(over serial console) or to fix issues before starting rio. It is surprisingly pretty decent experience.
Re:Nano 5.7 by bear8642 on Thursday April 29, 2021 @12:16PM (#26983048)
you joke, but ed is great if have tiny change to make given compiler output simply just to how fast it loads
Re:Nano 5.7 by cicero on Thursday April 29, 2021 @03:03PM (#26985137)
I used to use ed when all I had was a single terminal screen/window and a compiler error message. Ed doesn't clear the screen, so you can still see the message. Vi or emacs would clear the error message away. Of course, in a multi-window situation, the compiler output is usually in one window or pane and the editor in another, so this is moot now.
Re:Nano 5.7 by kstrauser on Thursday April 29, 2021 @12:37PM (#26983312)
I got a local login on a machine so busted that I couldn't mount /usr, meaning I couldn't read /usr/share/terminfo, meaning no screen editors would work. I knew just enough ed that I was able to fix /etc/fstab and bring the system up.

I wouldn't wanna use it every day, but it has its time and place.

Re:Nano 5.7 by donio on Thursday April 29, 2021 @01:34PM (#26984060)
"busybox vi" is another option in these situations when that's available. It will happily run in a blank chroot.

Everybody should know a little ed though, it's not that hard.

Re:Nano 5.7 by kstrauser on Thursday April 29, 2021 @04:53PM (#26986547)
It was on a server that didn't have busybox installed. Also, can busybox vi work without access to termcap or terminfo?
Re:Nano 5.7 by yjftsjthsd-h on Thursday April 29, 2021 @01:37PM (#26984092)
Honestly at that point, unless your fstab is really big, I'd just `cat /etc/fstab` and then `cat >/etc/fstab <<EOF` and very carefully retype it (I mean take a backup first of course).
Re:Nano 5.7 by kstrauser on Thursday April 29, 2021 @04:53PM (#26986558)
sed is also a friend in these situations.
Re:Nano 5.7 by marcodiego on Thursday April 29, 2021 @11:39AM (#26982552)
More than that, Benno Schulenberg, nano's main developer, is actively against changes turn nano into anything close to a mini-IDE. He rejected patches that could nano have code completion from external tools, multi-pane/screens, source code navigation and many others.

I respect his lead, but that discourages contribution.

Disclaimer: I'm a very sporadic nano contributor.

Re:Nano 5.7 by ponow on Thursday April 29, 2021 @12:38PM (#26983333)
In other words, Schulenberg doesn't want nano to slide on a slippery slope towards emacs.
Re:Nano 5.7 by sixstringtheory on Thursday April 29, 2021 @03:00PM (#26985099)
> that discourages contribution

I wouldn’t say it does so across the board. Rather, it filters contributions to only encourage those of the kind they desire.

There’s also the question of whether they even want “more contribution”. The less features, the less maintenance burden… Less maintenance burden, easier for fewer people to accomplish the work… Fewer people means less coordinating effort.

Simplicity seems to lead to a virtuous cycle here.

Re:Nano 5.7 by tommica on Thursday April 29, 2021 @07:09PM (#26987996)
Gotta respect that, he seems to have a vision, and keeps it in focus. Nano as a simple text editor is a blessing.
Re:Nano 5.7 by garyrob on Thursday April 29, 2021 @01:33PM (#26984046)
Personally I use jstar (a configuration of Joe) because in the 80's I used WordStar and I like using the same key combos. :)

But that's for small editing tasks. For coding I use VSCode or a JetBrains product.

Re:Nano 5.7 by cicero on Thursday April 29, 2021 @03:08PM (#26985200)
Upvote for mentioning WordStar. I only used it some in the Texas A&M computer lab. I went from my dad's Apple II, to a Commodore 64 I bought in college, to a Macintosh after I graduated. None of them were WordStar platforms, but I remember it was very popular in the CP/M and MS-DOS world before WordPerfect took over.
Re:Nano 5.7 by garyrob on Thursday April 29, 2021 @03:09PM (#26985215)
Yeah, my programming OS was CP/M
Re:Nano 5.7 by unixhero on Thursday April 29, 2021 @01:46PM (#26984166)
Check out jed!
Re:Nano 5.7 by CivBase on Thursday April 29, 2021 @01:50PM (#26984205)
I've always been surprised by nano's ubiquity since it comes across to me as a very niche application. It's a highly-accessible, bare-bones text editor... for a terminal, where the overwhelming majority of users will be "power users" who will likely value the additional features made available by vim or emacs. It's not a bad tool. I just seems to be designed for a very small demographic.
Re:Nano 5.7 by jejones3141 on Thursday April 29, 2021 @12:06PM (#26982932)
One thing I've found nano useful for: git commit messages.

If the commit file is empty, that cancels the commit. Nano will tell me how many lines it actually wrote, so if I have second thoughts I can cancel with certainty. Nano may well not be unique in that regard, but I tripped over another editor that saved what I thought was an empty file as a single line with just the EOL character.

Re:Nano 5.7 by MayeulC on Thursday April 29, 2021 @01:57PM (#26984295)
I like to quit vim with a non-zero return value in some exceptional cases. git and most other tools will interpret this as "something bad happened" and won't do anything further

    :cq
Re:Nano 5.7 by jolmg on Thursday April 29, 2021 @12:16PM (#26983056)
You can have a bunch of comments and empty lines, even with spaces, and git will still abort if you don't have anything else in the commit message. An EOL/newline character shouldn't cause the commit to continue.
Re:Nano 5.7 by chungy on Thursday April 29, 2021 @01:27PM (#26983973)
There are overrides to make empty messages or including otherwise-comments, but yeah... you have to do such things rather explicitly. No way you can do it by accident.
Re:Nano 5.7 by jolmg on Thursday April 29, 2021 @02:55PM (#26985013)
But none accept a single newline as a message while at the same time rejecting truly empty messages.
Re:Nano 5.7 by hiq on Thursday April 29, 2021 @12:44PM (#26983421)
I rarely write commit messages until they're ready, so I usually :q! when I realize I actually don't want to commit just yet.
Re:Nano 5.7 by ChrisClark on Thursday April 29, 2021 @01:36PM (#26984084)
Yeah, for quick edits I prefer nano. Might just be because I grew up with edit on DOS, and Out of the vi, emacs and nano it was the closest and I just stuck with it.

Any programming I do is in Jetbrain IDEs.

But I saw a comment here long ago that says it's worth learning vim keybinds, even if you never use vim. Because you can be sure, no matter what IDE or editor you end up using, someone has created a vim keybinds plugin. You can have the same keybinds across everything.

I've never gotten around to learning though.

Re:Nano 5.7 by Arnavion on Thursday April 29, 2021 @02:51PM (#26984958)
Meh, that vim keybinds thing is an exaggeration. Using arrows keys for moving the cursor, holding down Ctrl for jumping words, holding down Shift for selection, etc is even more consistent across editors, and doesn't even need any plugins.
Re:Nano 5.7 by ChrisClark on Thursday April 29, 2021 @03:35PM (#26985595)
I was more thinking of the benefits of vim-style, the advanced controls for moving and jumping around according to code structure. Not just jumping a word at a time, but jumping to a character, deleting a word, sentence, block, etc.

Those are not always standardized across editors.

Re:Nano 5.7 by Arnavion on Thursday April 29, 2021 @06:35PM (#26987649)
Deleting a word - Ctrl-Delete. Deleting a line - Shift-Delete.

Jumping to a character, deleting a block - while vim does have bindings for these, I've never found myself using them. For the latter especially, moving to the start of the block and then selecting to the end of the block is better to me just because it lines up with my eyes scanning the thing I'm planning to delete. With vim I would have to pause and double-check what I'm about to delete anyway, and if it doesn't fit in one page I'd have to move around to inspect it anyway.

Re:Nano 5.7 by qtoxic on Thursday April 29, 2021 @05:49PM (#26987241)
How does this have anything to do with Nano 5.7?