Neo Vim with ThePrimeagen (Neo Vim pt. 3)

Neo Vim Lesson Series

  Looking up all the Vim content on YouTube told the algorithm to send me some more. I stumbled upon a series by the creator ThePrimeagen that details more commands in Vim and Neo Vim. I’ll do my best to only add here what hasn’t been covered already. But if you’re interested, here’s the link to the full playlist.

Introduction (#1)

  This covers a lot of the basics that the Vim :Tutor does.

Horizontal (#2)

_ - go to the first filled character of a line
0 - go to the 0th space in a line

fx - jump to the next x in the line
Fx - jump BACK to the previous x in the line

tx - jump up to, but not on, the next x in the line Tx - jump BACK to, but not on, the previous x in the line

; - jump forward to the next instance of whatever you jumped to with f or t , - jump BACK to the next instance of whatever you jumped to with f or t

dfx - delete from the cursor up through the next instance of x in the line dtx - delete from the cursor up to, but not including, the next instance of x in the line

dFx / dTx - the same as the above but going backwards

yfx - yank from the cursor up through the next instance of x in the line ytx - yank from the cursor up to, but not including the next instance of x in the line

yFx / yTx - the same as the above but going backwards

d2fx - delete everything up to, and including, the SECOND instance of x in the line from the cursor

Vertical (#3)

  Making sure relative lines are set is going to make quick jumping with movements like 5j and 17k to move exactly where you need to up and down quickly much easier.

{ - move up by a paragraph {continuous, non-blank lines}

<Ctrl-d> - move half a page down <Ctrl-u> - move half a page up

zz - centers your view around your cursor position

gg - jump to the beginning of the file G - jump to the end of the file

:100 - jump directly to line no. 100

* - when the cursor is on a word, it will auto-load that into the search (next/previous with n/N) # - inverted search version of *

Advanced Motions P1 (#4)

vi( - if you’re in between parentheses, select everything within, but not, including the parentheses va( - if you’re in between parentheses, select everything within AND including the parentheses

  • with both of these commands, if you run them before the section you want, it will select the next occurrence in that line.

ya{ - yank everything within AND including the next brackets in the line

viw - select the whole word, no matter where your cursor is in that word

  • follow that with p and it will paste over the top of that word, in-line, rather than creating a new line viW - select all text until the surrounding white space within the line

Vy - does the same as yy but it can feel faster for some folks Vd - does the same as dd but it can feel faster for some folks

Advanced Motions P2 (#5)

v% - when the cursor is on a “(”, “[”, “{”, will highlight everything from that brace to the one it’s paired with including the braces

  • can be sped up using va{ discussed above

= - auto-aligns things according to the rule set. =ap - auto-align the whole paragraph

o - will transfer your cursor to either side of a highlighted section while in highlight mode.

yap - yank all contiguous code (no blank lines in between) including the white space yip - yank all contiguous code (no blank lines in between) not including the white space

dap - delete all contiguous code (no blank lines in between) including the white space dip - delete contiguous code (no blank lines in between) not including the white space

<Ctrl+v> - followed by j or k to create multiple cursors <Ctrl+a> - increment your selection once <Ctrl+a><Ctrl+a> - increment each element in your selection

From Shorts

diw - delete the word you’re in the middle of
diW - delete everything between the white spaces on the outside of where your cursor is