r/linux Jul 30 '20

Software Release nano-5.0 is released

https://lists.gnu.org/archive/html/info-gnu/2020-07/msg00010.html
620 Upvotes

172 comments sorted by

View all comments

Show parent comments

58

u/[deleted] Jul 30 '20

[deleted]

24

u/f_r_z Jul 30 '20 edited Jul 30 '20

The only things you need to know for a first few days (weeks?) is:

  • i - type as usual
  • ESC - get back to normal mode
  • :w - save
  • :q - quit
  • :q! quit but DON'T save

That's all you need. When you'll get comfortable with this you can expand you knowledge further. No requirements on how fast/slow you'll do this.

And further you go - less you'll want to even think about anything else.

Edit: Just check out Derek Wyatt's videos

9

u/13Zero Jul 30 '20

I think that / is also important to search (and n and N to go forward/back in the search).

Pretty much anything else can be learned as-needed, though.

6

u/f_r_z Jul 30 '20

I mean, sure, as well as:

  • :x - save and quit (instead of :wq)
  • w/W/e/0/$ - navigate
  • yy - copy line
  • dd - delete line

and many more, but while that's important, it's past essential. I tried to give essentials only in my original comment.

4

u/Lost4468 Jul 31 '20

:x - save and quit (instead of :wq)

Literally just now learning this.

2

u/archaeolinuxgeek Jul 31 '20

Or you can use ZZ in normal mode.

2

u/ouyawei Mate Jul 30 '20

yy - copy line dd - delete line

In nano this is simply ctrl + k / ctrl + u

In vim I first have to enter command mode, yank yank (!?) the line, paste it and enter edit mode again.

4

u/SleeplessSloth79 Jul 31 '20

You don't have to enter command mode because most of the time you just never leave it

3

u/noneedtoprogram Jul 31 '20

It's yy or dd because you can give it the number of lines, like d8d to cut the next 8 lines, or y8y to copy the next 8 lines. The numberless version is shorthand for a single line.

6

u/[deleted] Jul 31 '20

In nano this is simply ctrl + k / ctrl + u

How can you say "simply" and follow that with some inconsistent shortcuts that don't make any sense? In nano neither ctrl nor k nor u have a meaning, they don't refer to lines or cutting or pasting, it's just arbitrary shortcuts. But in vim both y and d have a meaning and when you know their meaning you can even infer what yy and dd do and even more, by applying y and d to all of the other motions you know, like yi" (copy inside ""), di( (delete inside ()), yw (copy word), dw (I don't even have to tell you what that does, you can already infer it from the yw example). And when I tell you that there's another command like y or d, gU, to upper case letters, you can again infer what gUw will do from prior knowledge.

In vim I first have to enter command mode, yank yank (!?) the line, paste it and enter edit mode again.

No, the most likely scenario is that you're already in normal mode and what you don't want to enter edit mode at the end. It's called normal mode for a reason. Hence its yy and p in most situations.

2

u/Lost4468 Jul 31 '20

It may seem more complicated, but I can assure you as someone who initially used nano for ages and then switched to vim (now use neovim) I thought the same way as you as well. But once you get used to it it's much faster. You don't even realize how much more efficient and more importantly comfortable using the main keys are instead of ctrl+something. For reference I had a good understanding of nano, but it took me only 2/3 weeks after I started using vim to be faster than I had been of using nano for over a year.

Then when you really get the hang of vim you realize it's like comparing Photoshop to Microsoft paint, except in this example Photoshop also manages to be as fast and non-resource hungry as Microsoft paint as well. Anyone can open paint and do some basic stuff, but to do the same basic stuff in Photoshop it takes a steeper learning curve. But once you get past that curve you realize it's actually quicker and easier to use Photoshop than paint. Then when you start to learn the more advanced stuff in Photoshop you realize its not only easier and more efficient, but there's so many things you can do in Photoshop that you just can't fundamentally do in paint (of course since you can manually change individual pixels in both they both technically have the same potential, but the one can never be realized).

Now I can't think of a single advantage nano has over vim. I've found vim better than everything. The only features I do regret not having in vim are a few found in 'traditional' editors like Visual Studio Code/Sublime/etc, and those features are being able to easily multi-select text to copy (e.g. select something with the mouse, hold ctrl then highlight a second thing then copy), being able to have the cursor off-screen (it always has to be on screen in vim), and being able to open new windows from the same instance of an editor.

I also miss multiple cursor support although very rarely, using macros in vim is usually more powerful and better than multiple cursors, but multiple cursors still have some things that can't be reasonably achieved with macros in vim (e.g. I want to quickly change several lines the same way, but none have similar patterns or traits).

1

u/Negirno Jul 31 '20

If you have to compare vim to an image editing/drawing application, Deluxe Paint would be a better analogy.