🚧 UNDER HEAVY CONSTRUCTION BECAUSE WORKERS UNIONIZED 🚧

Practicing NeoVim to become a real programmer

Friday, 29 September 2023 at 21.08
(Edited: 09/10/2023, 22.40)
How to exit Vim?
3 minute read
0 views

I will be updating this post, as I learn more about this godforsaken piece of engineering.

So I've seen the memes about Vim, how it's the best, the coolest, how the pros use it...

I've heard how it's nonsense, how hard it is to learn and how much time you'll be spending configuring Vim rather than actually using it.

So I wanted to see what the fuss was about. Installed NeoVim and got the familiarize myself.

Observation 0: You gotta learn how to read Vim commands

This is the biggest hurdle: Forget what <Esc>0f<Space>d3wP$Puuuuu:q! means or does: How the heck do you even READ that?!

For a good moment, I was really confused why "append" wasn't working as it was advertised. I kept pressing a and wondering what's the difference between it and i (insert).

I then realized it's not a, but A... (inserts at the end of the line)

Similar to seeing <C-r>(redo): That's not Shift + c THEN - THEN r , but Control + r

Observation 1: Vim has 2 modes

  1. Normal mode

    1. This is where pressing something does something... Like a command.

  2. Operator mode

    1. This is where you are currently inside a function and typing stuff will do something within it.

Observation 2: Vim was made by engineers

A lot of the "logic" behind Vim is "Vim motions", which are basically arguments to a function. Like typing d2w Deletes the next 2 words, but who the fuck is counting like that unless you're a psychopath? Normal human being does dw, dw

Does w stand for "word" or "write"? :wq vs. dw ?

Basic premise is this:

operator [number] motion

So for example:

d 2 w

Learning the different basic motions of Vim is the key in unlocking your 7 chakras and becoming the Chosen One.

And the clown who decided 0 = Home and $ = End is a sick, sick man... But I guess it makes sense if you're using like a 10% ergo-keyboard with 5 buttons. I use a 65% and it has Home, End, PgUp, PgDn on an Fn-key. (Å, Ä, P, Ö) But I don't think that's a standard feature, so I guess it makes sense...

So what about undo and redo, most common shortcuts? It's u and Ctrl + r

You might ask: "Why isn't redo just r, then?"

That's because r is replace. Now... I honestly don't see why you would use this operator. rx basically just replaces the letter under the cursor with x. But... Why not just do a <backspace> x <esc>? Like sure, it's 2 more buttons, but... Okay sure, if you start using motions more, it might start to make more sense...

Observation 3: Vim has a "store"

Let's say you delete a word using dw. It is now stored in Vimland, which is basically a clipboard. dw is kinda like Ctrl + X, so it cuts rather than deletes. If you want to paste this word somewhere, you do so by pressing p.

Observation 4: %, my beloved

I honestly find it really nice, because JSX sucks so bad and I've spent embarrassing amount of minutes trying to debug something when my only problem was screwed up parenthesis.

So having a dedicated button that just goes back and forth from (), [] or {} is so nice...

Observation 5: You can actually quit Vim without plugging off your computer

It's :q! to exit without saving and :wq to write a file and quit.


Please login to comment.

Comments: 0


Be the first to commment :)

Refresh counter test =
0