this post was submitted on 17 Oct 2025
21 points (95.7% liked)

GNU+Linux Humor

5479 readers
1 users here now

Memes, jokes and general humor about GNU+Linux

Rules:

founded 6 years ago
MODERATORS
 

I've noticed that people older than me have always known just a few more vi commands than I do.

I'm in my 40s, so clearly I know about 4:

Writes and quits (I consider these variants of the same thing):

:w
:q
:q!
:wq
ZZ

See the line numbers: :set number

Delete everything from top to bottom (must be at top, easily remembered by mumbling duck, duck, duck, GOOSE): :dddG

Search for a string: /

And that's probably it. I think I used to know how to cut a line and paste a line, but I'd have to look it up to be 100% correct on the syntax.

Anyone in their 50s or 60s care to add to this dazzlingly long list of inadequacy? Not looking for a cheat sheet or the man page :-p

top 10 comments
sorted by: hot top controversial new old
[–] hellfire103@lemmy.ca 5 points 3 months ago

I'm 19 and I know nine.

:w
:q
:wq
:q!
yy
dd
p
u
^r
[–] Pencilnoob@lemmy.world 3 points 3 months ago

My friend is giving away some free copies of his book for learning vim, it's been super helpful for me. First come first serve

https://leanpub.com/deliberatevim/c/p1cPq3Bb9

[–] TechLich@lemmy.world 3 points 3 months ago (1 children)

I know a few more interesting ones but nowhere near what actual vim people know.

  • d, y, p - delete, yank, paste as others have said.
  • r - replace the character under the cursor with something else
  • g - go somewhere (gt is go to next tab which you can open with :tabedit )
  • v - visual mode for selecting text to yank with y
  • c - change - deletes a thing and goes to insert mode, like d but not. Eg.
    • cc - change the current line
    • cw - change the next word

My favourite is ci - change inside

ci" - changes all the text that's inside the next set of quotes.

ci( changes the text inside the next set of parentheses. Etc.

I also use :mouse=a which I'm told is sacrilege but sometimes I like to click on a thing!

Ooh nice ci is a new one for me, gonna try to encode that one

you can also parameterize the change word command, e.g. c3w will delete the next three words and put you in insert mode. it's handy for changing multiword variables or paths.

[–] BCsven@lemmy.ca 3 points 3 months ago* (last edited 3 months ago)

I still have my tractor feed print out of the vi manual from 1991.

3dd Delete 3 lines

3yy yank 3 lines

P and p put back text after or before cursor

Tx move to character after the x

[–] everett@lemmy.ml 3 points 3 months ago

cut a line and paste a line

dd to cut a line, p/P to paste below or above current line

Delete everything from the cursor up until a particular character on the same line, not including that character. For example, until the next close-parenthesis: dt)

Increment the number under cursor: Ctrl-a

Decrement the same (I always forget this one): Ctrl-x

[–] Farnsworth@lemmy.world 2 points 3 months ago* (last edited 3 months ago)

Very useful for renaming a variable: * to search "word" under cursor. Try this with hlsearch on::set hlsearch. Then cw to change a match. Alternate n and . to quickly rename more occurrences of the word. Do a :noh to get rid of the highlighting. Maybe try :set noinc, some people prefer the traditional "non-incremental" search.

Do all this in normal mode. Vim experts leave insert mode as soon as possible. Almost forgot: Pressing C-c takes you back to normal mode without leaving home row.

Most important advice: Never touch arrow keys. Keep your fingers on the home row. Learn hjkl movement (focus on j and k, they are more important). Then get faster by using b, w, f, o, O, A, I, C-d and all the rest. Learn about J, it's cool. You won't get far without u and C-r though.

Critically important advice for fellow Europeans: If you care about vim, consider learning the US keyboard layout. Default bindings are not convenient in other layouts like qwertz (where is forward slash on qwertz? Hello?), and learning US layout might be easier than learning to customize vim. On a typical modern Linux system, there are US layout variants that still allow typing Umlauts, like EurKey or "DE-US", where you type ä by pressing RightAlt+a, for example.

[–] collapse_already@lemmy.ml 1 points 3 months ago

I am in my 50s and have used vi/vim as my principal editor for 30 years. I don't think enumerating commands will be possible. If you have questions about how to do something, I will try to answer them.

[–] 1984@lemmy.today 1 points 3 months ago

Its too much you left out but I recommend buying a vim book! It will upskill you to master.

[–] owsei@programming.dev 1 points 3 months ago

:%s for changing a string on the entire file (I think it also works with selections instead of entire file)

:m+{num} to move a line

:tabe to open another tab (not split)

:te open terminal

:wqa write and quit all buffers (will fail with non-writrable buffer, like a terminal, sadly)

:!{shell command} execute

:r!{shell command} execute and write to current buffer

:cd change directory

Not a command, but useful to remember % means current file (eg. :!rm %)

I'm 19, and the plan is to learn all before 200