<commit_before>---
title: "Using vim"
date: 2017-09-28 09:10:00 -10:00
categories: linux
layout: post
---
## How to search in vim
Search command
```
ESC + : + / + [search pattern] + enter
```

Next match
```
n + enter
```

Previous match
```
N + enter
```
## How to navigate in vim
Go forward by word
```
w
```
Go back by word
```
b
```

## How to select, copy and paste in vim
Select a line (up/down arrow key to include more/less lines)
```
V
```
Select texts (letter by letter)
```
v   
```
Select blocks 
```
ctrl + v
```

Then
Delete
```
d
```
Copy (called 'yanking')
```
y
```

Then
Paste after cursor
```
p
```
Paste before cursor
```
P
```

Note: there is no default cutting operation that could be done with one command.

## How to undo
```
u
```

## Opening new tabs
```
ESC + : + tabnew
```
To open a new tab,
and 
```
ESC + : + saveas [filename]
```
to save the file.<commit_msg>update post<commit_after>---
title: "Using vim"
date: 2017-09-28 09:10:00 -10:00
categories: linux
layout: post
---
## How to search in vim
Search command
```
ESC + : + / + [search pattern] + enter
```

Next match
```
n + enter
```

Previous match
```
N + enter
```

## How to navigate in vim
Go forward by word
```
w
```
Go back by word
```
b
```
Move one character left
```
h
```
Move one character right
```
l
```
Move one row down
```
j
```
Move one row up
```
k
```


## How to select, copy and paste in vim
Select a line (up/down arrow key to include more/less lines)
```
V
```
Select texts (letter by letter)
```
v   
```
Select blocks 
```
ctrl + v
```

Then
Delete
```
d
```
Copy (called 'yanking')
```
y
```

Then
Paste after cursor
```
p
```
Paste before cursor
```
P
```

Note: there is no default cutting operation that could be done with one command.

## Lines
open a line below the cursor and start insert mode
```
o
```
open a line above the cursor
```
O
```


## How to undo
```
u
```

## Opening new tabs
```
ESC + : + tabnew
```
To open a new tab,
and 
```
ESC + : + saveas [filename]
```
to save the file.
{'fraction_non_alphanumeric': 0.17261904761904762, 'fraction_numerical': 0.017857142857142856, 'mean_word_length': 3.328326180257511, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4600783', 'n_tokens_mistral': 827, 'n_tokens_neox': 717, 'n_words': 293}