# Vim Commands you must Know

> These commands work in command mode.

> ```Esc``` is used to exit insert mode and enter command mode.

### 1. Move Cursor

```markdown
j - down
k - up 
h - left
l - right

8j - 8 lines down
8k - 8 lines up

gg - top 
G - bottom

w - move forward one word
b - move backward one word
```
<hr>

### 2. Enter into INSERT mode

```markdown

i - insert before the current character
I - insert at the beginning of the line

a  - inset after the current character 
A -  insert at the end of the line

o - insert next to the current line 
O ( not zero) - insert before the current line 

```

<hr>



### 3. Exit Vim

```markdown

:q - exit if no change are made 
:q! - exit and ignore the change made 
:wq - write the change and then exit 

:w new_name - save the file with the new name

ZZ - Write the current file, if modified, and exit. 

```

<hr>


### 4. Deleting Text

```markdown
x - delete the current character 
dd - delete the current line 

```

<hr>


### 5. Copy Paste

```markdown

yy - copy the current line **to the store buffer**

p - paste after the current line  ** from the storage buffer ** 
P - paster before the current line
```

> Vim copy and pastes to and from the storage buffer and not the system clipboard

> If you want to use the system clipboard then just enter in to insert mode and to copy select the text and press ``` ctrl + c ``` and to paste press ``` ctrl + v ```

### 6. Undo and redo

```markdown
u - Undo the last operation 
CTRL + r - redo the last undo

```
