# Vim
Jovian cheat sheet for vim

## Commands

### Bookmark
`mx` to bookmark with letter _x_

``` 
`x 
``` 
to go to _x_

### Case
`gu` and movement to lowercase

`gU` and movement to uppercase

### Write with SUDO

#### On the fly fix

when you forgot to sudo with Vim ...

`:w !sudo tee %`

Beware, that is not recommanded to run a editor as Vim.

#### The right way

Use `sudoedit`

## Regex

### End of line

Catch with `\n` and put one with `\r`.

## Diff
__vimdiff__ basics

### Configure git
`git config --global diff.tool vimdiff`

### Make contents identical
`dp` : diffput throws changement in the other window

`do` : diffget obtains changements from the other window

### Jump between diffs
`]c` next

`[c` previous

### Resolving a conflict

Three files : LOCAL | BASE | REMOTE

+--------------------------------+
| LOCAL  |     BASE     | REMOTE |
+--------------------------------+
|             MERGED             |
+--------------------------------+

Three commands : `:diffget LO`, `:diffget BO`, `:diffget RE`

### Unfold

`zo`

Useful to see more context.
