Useful VIM shortcuts

Shravan C
2 min readJul 5, 2020
https://commons.wikimedia.org/wiki/File:Vimlogo.svg

A short introduction, vim is an improved version of VI editor. I was introduced to it in one of the institute who taught me the C programming language. I am glad to be introduced to it. I love programming in VIM editor. I have gotten used to it so much that I can't get out of it. Recently I started using Pycharm though, still experimenting with it, but I love VIM.

Here are a few useful shortcuts for vim:

Commands are highlighted to avoid confusion. Please do mention in the comments the one you like the most.

Cursor Navigation:

L = move the cursor to the bottom of the screen
M = move the cursor to the middle of the screen
H = move the cursor to the top of the screen

G = move the cursor to the bottom of the file
g + g = move the cursor to the top of the file

z + z = move the cursor to the center of the screen
z + t = move the cursor to the top of the screen

Use case:
1. go the bottom of the screen and then bring the cursor to the centre:
(shift + l) → (z + z)

Linewise Navigation:

0 = start of the line
^ = start of the first charecter
$ = end of the line

Deleting:

d + a + w = delete a word
d + a + “ = delete all the content inside “ along with “. Ex: var + “something” — > var +
d + i + “ = delete just the content inside “. Ex: var + “something” — > var + “”

d + t + “ = delete all the charecter till the next “. Ex: var + “something” — > “something”
d + f + “ = delete all the charecter along with “. Ex: var + “something” — > something”.

Hope this helps, will update the list as and when I come up with new shortcuts. A reference for the same can be found in this link and another. Enjoy coding!!!

--

--

Shravan C

Software Engineer | Machine Learning Enthusiast | Super interested in Deep Learning with Tensorflow | GCP