update vim syntax

This commit is contained in:
Malin Freeborn 2025-03-26 14:07:27 +01:00
parent a6b8420c26
commit 641b8fb825
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
6 changed files with 37 additions and 49 deletions

View File

@ -1,34 +1,21 @@
---
title: "vim navigation"
tags: [ "vim" ]
tags: [ "vim", "navigation" ]
---
| Move | Command |
|:-----|:-------------|
|Down page | C-f |
| Down half page | C-d |
| Up page | C-b |
| Up half page | C-u |
## Scroll
> C-e
> C-y
## Jumps
Go through your last jumps:
> C-I
> C-O
Go to the last and previous places you've changed:
> g;
> g,
| Move | Command |
|:------------------------|:-------------|
| Down page | Ctl-f |
| Down half page | Ctl-d |
| Up page | Ctl-b |
| Up half page | Ctl-u |
| Scroll down | Ctl-e |
| Scroll up | Ctl-y |
| Jump to previous place | Ctl-i |
| Jump to back | Ctl-o |
| Jump to last change | g; |
| Jump to next change | g, |
| Go to current filename | gf |
Go to a filename, and type `gf` (Go-to-File).
For example, if you put your cursor over the `~/.vimrc` in this line, you can edit your vim configuration file.
@ -39,10 +26,10 @@ For example, if you put your cursor over the `~/.vimrc` in this line, you can ed
Make a 20 character 'visual split' in the current working directory ('`.`').
> :20vs .
`:20vs .`
Change the view for this:
Swap buffer positions:
> C-w x
`C-w x`

View File

@ -1,16 +1,16 @@
---
title: "vim completion"
tags: [ "vim" ]
tags: [ "vim", "completion" ]
---
Complete the word by searching for the *n*ext similar word:
> C-n
`C-n`
Complete the word by searching for a *p*revious similar word:
> C-p
`C-p`
Complete the full line:
> C-x C-l
`C-x C-l`

View File

@ -1,22 +1,22 @@
---
title: "vim search"
tags: [ "vim" ]
tags: [ "vim", "search" ]
---
Search for the next and or previous occurrence of the word under your cursor with `*` and `#`.
Search and replace the first 'one' found with 'two':
> :%s/one/two/
`:%s/one/two/`
Same, but replace 'one' globally:
> :%s/one/two/g
`:%s/one/two/g`
Put quotes around every occurrence of `$HOME`:
> :%s/$HOME/"&"
`:%s/$HOME/"&"`
Same, but add curly brackets around `$HOSTNAME`:
> :%s/$HOSTNAME/{&}
`:%s/$HOSTNAME/{&}`

View File

@ -3,12 +3,12 @@ title: "vim windows"
tags: [ "vim" ]
---
| Command | Keys |
|:-----|:----:|
| split window | C-w s |
| split window vertically | C-w v |
| close window | C-q |
| change window | C-w w |
| rotate windows | C-w r |
| split open new file | :sf path/file |
| Command | Keys |
|:--------------------------|:-------------------:|
| split window | `C-w s` |
| split window vertically | `C-w v` |
| close window | `C-q` |
| change window | `C-w w` |
| rotate windows | `C-w r` |
| split open new file | `:sf $filepath` |

View File

@ -7,7 +7,7 @@ Put bash in vim mode!
Place the following in your `~/.inputrc`:
```bash
```
set editing-mode vi
set show-mode-in-prompt on
set vi-ins-mode-string \1\e[33;32m\2[>]=\1\e[0m\2

View File

@ -1,9 +1,10 @@
---
title: "Vim Tricks"
tags: [ "vim" ]
requiered: [ "ssh" ]
---
## Remote Editing
> vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*
`vim scp://*user*@*myserver*[:*port*]//*path/to/file.txt*`