VIM


Uncategorized

Updated May 15th, 2022

Cheat-sheet of commands here

Fireship Video

Ben A video

Macros

VIM fireship https://youtu.be/-txKSRn0qeA

:q – quit VIM
:q! – quit without saving changes
:wq – save and quit
i insert mode

Can use VIM to open up a file “vim hello.js “

start in normal mode but can toggle between insert, command and visual modes with i, :, and v respectively. ESC back to normal mode.

hjkl move around like arrow keys
x delete character.
dd delete entire line
u undo
:whatevsNumber
+p to paste from system clipboard
:w to save
:!node hello.js to run the command

Don’t need to ditch VSCode to get the benefits of VIM. Why learn VIM? Evergreen skill, learn once, lasts forever. Work faster and more efficiently without leaving the editor. Can do more from the keyboard.

1.) Inside VSCode search for VIM extension vscodevim.vim 2.2m downloads.

2.) Set up key repeating by running command from installation docs in the terminal, (not needed for windows). If you i to enter insert mode and then the enter key a bunch to create lines. Then hit escape and then hit and hold k to go up. If this works you are good to go.

a lot of people re-map caps lock to be the escape key so its closer.

iIaA

i – insert mode to the left of the hilighted character
I – insert mode at the beginning of the current line
a – insert mode to the right of the hilighted character
A – Enter insert mode at the end of the line. Appending to the end of the line.

xr – making changes while in command mode

x is like delete out a character

r is for replacing characters under the cursor with the new cursor you type in.

VIM Basics in 8 Minutes

WARNING: with the VIM extension the normal VSCode shortcuts like ctrl + j no longer opens the editor? ctrl backticks still opens the editor

Bu the copy and paste hotkeys no are differet too?