Hacker News new | ask | show | jobs
by pawnednow 2150 days ago
Nano has always been my go to editor. It comes natively with most install and is very easy to use. It has all the shortcut listed on page so it is quite user friendly out of the box.

After learning vim for a bit, I find nano quite superior for my use case mainly editing files inside terminal on remote servers.

6 comments

Not only do I totally agree, but the words you used were almost verbatim what I was composing in my head while waiting for this page to load. It was a bit crazy to see my exact thought already as a comment.

But yeah, editors are just a preference, especially when every single one of them works in 90% of cases. I actually forked nano a long time ago (back in college) just to implement some niche multi-cursor hack because one guy said it was one thing vim could do that nano couldn't. I know there's plenty that <any editor> can do that <some other editor> can't, but nano's always Just Worked and occupied a very special, reliable, spot in my heart.

Nano is great. Too many linux installation or config editing guides recommend using vi, so I can see why that would put so many beginners off
As a huge fan of Vim, I begrudgingly admit you have a point.

To someone new to the command-line, Vim is not at all approachable. Once you know your way around Vim, it's a fantastic editor, and frankly Nano just doesn't compare, but you can't expect a newbie to be able to use Vim effectively. Without a tutorial and a deliberate effort to learn it, Vim is rather baffling.

To the question of what should be the default, I suppose it depends on the context. A power-user distro wouldn't have much use for Nano, the choice would be between Vim and Emacs.

My main problem with vim was, that I spent deliberate effort to learn some of its shortcuts, but I need to use text editor in a console only a few times per week, like change some config file or add line to cronjob. And then one tends to forget all the shortcuts, when not using it regularly enough.
Many IDEs and other editors have a vi-mode either built in or available as a plug in. I don’t use vim itself much (at work, at least) but I use vi keybindings everywhere.
Which are your favorites?

I have used the IdeaVim plugin for IntelliJ, and honestly it was so bad it was worse than not having the plugin at all. Maybe 20% of commands actually behaved consistently with vim. And IIRC, a decent chunk of my preferred vim functionality was outright unimplemented.

Perhaps ironically, I didn't have any such problems with the (commercial) plugin for Visual Studio. It worked very well. It cost $100, but my employer paid for that.

I've basically given up on IDEs after that and just use vim itself. If you know of any that have a really good vi-mode plugin, I'd love to try one!

Emacs has a pretty good vi mode called evil. I use spacemacs, but I am not sure, if it is what you are looking for. Should you try it, do yourself a favor and use the development branch. I read good things about doom Emacs as well.
Yes, I think it only makes sense to learn vim if you're going to spend a lot of time using it actively. I use vim for almost all programming I do, so that made it really easy to burn it in my brain forever.
When vi or vim opens for the first time, it should simply state 2 things:

- New to vi(m)? Close the editor by typing :q!

- Learn vi(m) by running the following program: vimtutor

Vim effectively does that with its splash screen:

                  VIM - Vi IMproved

                   version 8.2.814
               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

The problem is that a total noob will still be overwhelmed, Vim's UI is simply too different from modern UI conventions.

That's why I think it makes total sense for nano to be the default editor in this day and age, even it if means that I'll have to remember to set EDITOR properly if I want to use vi(m).

I think that's way too much information and agree that new users will feel overwhelmed.
This doesn't fix the problem. If it's a newbie, they should be given Nano. They probably just want to get the job done, whatever it may be. It shouldn't be assumed that now is the time for them to learn Vim (which is no small thing). Neither should it be assumed that quitting Vim solves the problem. They might not know how to reconfigure the default editor that some other program is using, for instance.
As long as I can remember, Gentoo manuals always assume you to use nano by default (although you can of course choose another). It's a distro that asks you to edit dozens of files in the installation process, and nano is definitely up to the job.

I guess they are being accommodative to people who don't know any editor to use, since those who have their favorite editor don't need to be told.

It's a matter of what you are used to. I'm used to VIM, so when I unexpectedly am dropped into Nano I'm a bit confused (never got around to using it much).

That being said, for new users without bias, nano definitely seems easier.

After about 14 years of considering Vim as my primary text editor and slowly attempting to forge a configuration that I was happy with, I recently resigned to the fact that I simply was never going to actually reach that point of having a configuration I'm happy with. I don't use Vim outside of the terminal; I spend most of my time in IntelliJ IDEA. I never found the Vim key bindings in IntelliJ IDEA close enough to the real thing to use, either.

So if I can't keep muscle memory of Vim keybindings, and I have never found a Vim configuration I've been happy with, why was I so stubbornly holding onto the idea that Vim was the right editor of choice for me? I don't know, but I finally changed my mind and looked for another editor. A dead simple one with sane defaults.

It came down to Nano vs Micro for me. Both are great. I ended up liking Micro a bit better, although I'm very glad to see that Nano development is still active.

Other than being a great editor, Vim has great value as a sort of practical joke you can play on people new to the command line.

"You can't figure out how to get out of the editor? I'm busy, stop asking me stupid questions. Look for the answer on Stack Overflow. Make sure to leave your mark there by up-voting the answer."

Yes, I hate people that can't read, too. Vim fucking tells you how to quit as soon as you hit ctrl^c. What the fuck m8. It's not even a funny joke anymore. It's just pure cringe.

On topic: It's weird that nano is so beloved, but good that GNU just keeps pushing out things as long as they are used.

Says this...

Type :qa! and press <Enter> to abandon all changes and exit Vim

Maybe not quite what the user was looking for. But I guess it does get you out of Vim.

ETA: Also, that answer on Stack Overflow at one time was the answer with the most traffic on the site. Reading must be a common problem for trapped Vim users.

I think abandon-changes is probably the best suggestion for most people in that situation. If you don't know how to exit you've probably made some accidental changes.
Vim tells you in the center of the screen how to quit when you start it up.
Only if you you're not opening an existing file.
> Nano has always been my go to editor. It comes natively with most install

While vi comes with all installs

> is very easy to use. It has all the shortcut listed on page so it is quite user friendly out of the box

Tell that to the users that don't know what ^ stands for

> After learning vim for a bit, I find nano quite superior for my use case mainly editing files inside terminal on remote servers.

I just don't understand how this is possible, except if you're doing very basic edits (even in that case...)

>Tell that to the users that don't know what ^ stands for

If you run `nano` it shows a message that you can get help using 'Ctrl-G'. In the second paragraph it tells you what '^' stands for. It will be a problem if you somehow ended in nano unintentionally. Even then someone can figure that it means either 'Alt' or 'Ctrl', that is the modifier keys.

>I just don't understand how this is possible, except if you're doing very basic edits (even in that case...)

Some people prefer or/and find easier to work with a modeless editor.

>I just don't understand how this is possible

I use nano as my daily driver, and here is how:

- I have a nanorc I copy around but am quite comfortable without. Here it is. You can use it under WTFPL-1. Feel free to fork it, but I'm not accepting pull requests.

  set multibuffer
  set nohelp
  # Defaults for older versions
  set nowrap
  set smooth
  set morespace
  unset boldtext
- I use ^K and ^U to cut and paste lines of text.

- If I need to edit multiple files, I use ^R

- If I need to find and/or replace, I use ^W (find), optionally with ^R (replace) and/or M-R (Regexp).

- Sometimes I need to go to a specific line/col, so I use ^_

Basically there's nothing else I want my text editor to do. I want minimal magic.

I know it's not the point you were answering too, but this is exactly why I don't think I will be comfortable in nano, ever. I already know vim, and I don't really bother to remember another set of shortcut just for nano.

When vi/vim aren't available, I usually just end up using sed.

The only thing you need to remember with Nano is that ^ means Ctrl. The rest you can find by reading the menus or the built-in help.

Which is why I prefer Nano over vim, I don't edit _that_ much from the console so I only have one easy thing to remember.

That's reasonable, but all the things a I listed are on the standard help bar, so the learning curve is minimal.

If there's no nano available like on busybox, I'll default to vi, but I don't prefer it.

At least in my case, I use nano typically for very simple edits, such as config files, fstab, etc. While I can use vim, I never “really” adopted it and get especially confused by the old “vi”.

As such, I almost always just grabs nano for these things, and use an IDE when working on code.

^ is quite obvious if you’ve tried to use any keyboard shortcuts in the terminal while a program is running.
Not really. Only after your comment i realized that it stands for any key at all. I never actually thought what it means before.
Yeah, for me when I was learning it was not-obvious, but wikipedia has an article on "Carat notation" I found by searching something like "what does carat mean in a terminal" on google.

Unfortunately, for me when I googled that exact phrase just now it gives a "Featured Snippet" saying it means "the beginning of a line", which is about regexen and and also only sort of right in that context. The wikipedia page is the first real result though.

Edit: I was spelling caret wrong. oops.

You mean "caret". "Carat" is something else: https://en.wikipedia.org/wiki/Carat_(mass)
I never had to Bing how to quit nano.
Ubuntu ships with nano by default? And every district Ubuntu I’ve used is defaulted to nano?
Ubuntu is nowhere near the only major distro. Maybe on the desktop, but most likely not on the server.

Edit: Also there are a lot of stories of "this old system that is central to our operation that nobody except that one guy 10 years ago knew how to set up" in companies.

I understand that Ubuntu may not be the /most/ popular distro. (tho everyone I know who runs Linux in AWS/GCE/Azure seems to run Ubuntu except me, I'm on Amazon Linux 2)

But the person I replied to said 'all' which is incorrect. If he said 'most' or something I wouldn't have replied :)

He said that vi is present in all distros, which is correct as far as I know. Not that it's the default.
I’ve been having trouble finding vi/vim lately on some installs, namely Ubuntu, although maybe they just leave it out of the default docker image? I use it sometimes for debugging conf files in between docker builds. But if you have to install something anyway, maybe it doesn’t make any difference if it’s vim or nano (emacs, though, I mean come on).

I think also I was on a real Linux box a few weeks ago (can’t remember what distro, sorry) that only came with ed by default. That was interesting, at least until I gave up and installed vi.

> except if you're doing very basic edits (even in that case...)

Most edits I do if I'm not on my daily driver is basic edits. Making adjustments to config files, etc. Doesn't require all the magic of Vim. Still prefer Vim though. Not having my Vim keybindings in an editor is like using a keyboard with a different layout.

Tell that to the users that don't know what ^ stands for

The users who have already figured out how to open a terminal, find their file, know what nano is and how to launch it?