2022-12-24 17:42:40 +01:00
|
|
|
|
2022-12-24 17:09:22 +01:00
|
|
|
+++
|
2023-02-27 21:59:02 +01:00
|
|
|
date="2023-02-04"
|
2022-12-24 17:09:22 +01:00
|
|
|
author="spanskiduh"
|
|
|
|
title="VIM"
|
2022-12-24 17:42:40 +01:00
|
|
|
description="click to read about VIM"
|
2022-12-24 17:09:22 +01:00
|
|
|
+++
|
|
|
|
# VIM
|
|
|
|
Comment Multiple Lines
|
|
|
|
- `:15,25s/^/#` ~ comment from line 15 to 25.
|
|
|
|
- `%s/foo/bar/g` ~ replace all apearances of `foo` with `bar` in whole file
|
|
|
|
- `s/foo//g` ~ delete all apearances of `foo` in a line
|
|
|
|
- `:[range]s/{pattern}/{string}/[flags] [count]` this is how it is structured out
|
|
|
|
|
|
|
|
### Navigation
|
|
|
|
- `hjkl` from now on use this keys
|
|
|
|
- `x[visual]` delete character at current pos
|
|
|
|
- `dw[visual]` delete a word
|
|
|
|
|
|
|
|
-- vimtutor 2.5
|
|
|
|
|
|
|
|
|
|
|
|
#### Nerdtree
|
|
|
|
- `s` - open horizontally
|
|
|
|
- `i` - open vertically
|
|
|
|
|
|
|
|
#### Panes
|
|
|
|
- `ctrl + w` - move through panes
|
|
|
|
- `ctrl + w s` - split horizontally
|
|
|
|
- `ctrl + w v` - split vertically
|
|
|
|
|
|
|
|
### Coc
|
|
|
|
|
|
|
|
#### code navigation
|
|
|
|
- `VISUAL over function name -> gd` ~ go to function definition
|
|
|
|
- `VISUAL over data type -> gy / gi` ~ go to type definition
|
|
|
|
- `VISUAL over function/ datatype -> K` ~ show documentation
|
|
|
|
- `INSERT -> ctl + space` ~ toggle autosuggestions
|
|
|
|
- `ctl + o` ~ return back
|
|
|
|
- `VISUAL gf` ~ go to file
|
|
|
|
- `ctl + o` ~ take me where i have bene before
|
|
|
|
- `ctrl + i` ~ take me forward
|
|
|
|
|
|
|
|
### Save
|
|
|
|
- `:sav file.txt` ~ save new file
|
|
|
|
- `:new file.txt` ~ create new file and open horizontally
|
|
|
|
- `:vsp file.txt` ~ create new file and open vertically
|
|
|
|
|
|
|
|
### Nvim tree mappings
|
|
|
|
` :help nvim-tree-default-mappings`
|
2023-02-27 21:59:02 +01:00
|
|
|
|
|
|
|
|
|
|
|
## Marks
|
|
|
|
|
|
|
|
Add mark with `ma`
|
|
|
|
|
|
|
|
And then list them with `:marks`
|
|
|
|
|
|
|
|
Select the mark with `'x` where x is the character thas is next to the mark listed using `:marks` command.
|
|
|
|
|
|
|
|
|
|
|
|
| Command | Description |
|
|
|
|
|:---------:|:-------------------------------------------------------------:|
|
|
|
|
| ma | set mark a at current cursor location |
|
|
|
|
| 'a | jump to line of mark a (first non-blank character in line) |
|
|
|
|
| `a | jump to position (line and column) of mark a |
|
|
|
|
| d'a | delete from current line to line of mark a |
|
|
|
|
| d`a | delete from current cursor position to position of mark a |
|
|
|
|
| c'a | change text from current line to line of mark a |
|
|
|
|
| y`a | yank text to unnamed buffer from cursor to position of mark a |
|
|
|
|
| :marks | list all the current marks |
|
|
|
|
| :marks aB | list marks a, B |
|