Nvim Commands 101 ๐๐ป
Anirudh Singh Bhadauria
3 min read
Inside a block keys -
Action | Command |
yank inside " " / () / {} / [] | yi" / () / {} / [] |
delete inside " " / () / {} / [] | di" / () / {} / [] |
edit inside " " / () / {} / [] | ci" / () / {} / [] |
Whole line operations-
Actions | Command |
dd | delete the whole line |
cc | change the whole line |
yy | copies the whole line |
V | select the whole line |
D | delete the line from cursor to the end |
C | changes the line from cursor to the end |
Y | copies the whole line |
d0 | delete the line form cursor to the start |
c0 | change the line form cursor to start |
v0 | select the lilne from cursor to the start |
y0 | yank the line form cursor to the start |
Motions -
Action | Commnad |
h / j / k / l | move left/down/up/right |
W/w | move one word forward |
B/b | move one word backward |
gg | move to the top of the file |
G | move to the end of the file |
zz | move the window to the middle |
o | move to the next line with edit mode |
shift + h | move to the tab on the left |
shift + l | move to the tab on the right |
shift + [ | move down in file (fast) |
shift + ] | move down in file (fast) |
Word commands -
Action | Commands |
dw | delete the word you are on |
yw | yank the word you are on |
cw | change the word you are on |
ciw | change in word |
diw | delete in word |
yiw | yank in word |
viw | select in word |
db | delete previous word |
cb | change previous word |
yb | yank previous word |
vb | delete previous word |
Searching Commnads -
Actions | Commnads |
searching | type '/' in normal mode, search for keyword, press enter, move between words with 'n' and 'N' |
searching | |
& | |
replacing | :%s/foo/bar/g Find each occurrence of 'foo' (in all lines), and replace it with 'bar' |
To find all occurrences of 'foo' in the current line, add the g flag. :s/foo/Vim/g |
Misc Commnads -
Action | Command |
gcc | Comment line |
\== | fix indentation |
0
Subscribe to my newsletter
Read articles from Anirudh Singh Bhadauria directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Anirudh Singh Bhadauria
Anirudh Singh Bhadauria
Hello world!, I am a software engineer who loves MMA โจ I integrate Data engineering and software engineering together to make beautiful software solutions that actually solves problem. I love to make projects that make an impact and as you are reading this I am working on one!