DEV Community

Cover image for Vim: The good parts
Mark Cabanes
Mark Cabanes

Posted on

Vim: The good parts

Introduction

Vim is the dark side of the programming, you can rule everyone with vim. the power to rule everyone

Modes

Vim has several modes with different functions but these are the most commonly used.
The easiest way to know what mode you are in is by looking at the status bar at the bottom of the editor.

Normal mode

Normal mode is Vim's default mode. When you are in normal mode you can navigate, perform operations, and destroy your keyboard.

How to move

h -> move to left
j -> move to down
k -> move to up
l -> move to right

0 -> move to the beginning of the line
$ -> move to the end of the line

w -> move to the next word
b -> move to the back word
e -> move to the end of current word

gg -> move to the beginning of current buffer
G -> move to the end of current word

:q -> exit from the editor
:w -> save the editor

Insert mode

In this mode you can enter text, delete and edit the document.

Commands

i -> enter insert mode to the left of the cursor.
a -> enter insert mode to the right of the cursor.

I -> enter insert mode to the beginning of the line.
A -> enter insert mode to the end of the line.

o -> enter insert mode one line down.
O -> enter insert mode one line up.

Visual mode

In this mode you can select parts of the document, copy them, cut them, delete them and paste them.

Commands

y -> yunk the selected characters.
d -> cut or deleted the selected characters.
p -> paste.

Conclusion

If you learnt something from this article, please let me know in the comments.

Thanks for reading.
100% of the brain

Top comments (0)