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" title: "vim navigation"
tags: [ "vim" ] tags: [ "vim", "navigation" ]
--- ---
| Move | Command | | Move | Command |
|:-----|:-------------| |:------------------------|:-------------|
|Down page | C-f | | Down page | Ctl-f |
| Down half page | C-d | | Down half page | Ctl-d |
| Up page | C-b | | Up page | Ctl-b |
| Up half page | C-u | | Up half page | Ctl-u |
| Scroll down | Ctl-e |
## Scroll | Scroll up | Ctl-y |
| Jump to previous place | Ctl-i |
> C-e | Jump to back | Ctl-o |
| Jump to last change | g; |
> C-y | Jump to next change | g, |
| Go to current filename | gf |
## Jumps
Go through your last jumps:
> C-I
> C-O
Go to the last and previous places you've changed:
> g;
> g,
Go to a filename, and type `gf` (Go-to-File). 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. 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 ('`.`'). 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" title: "vim completion"
tags: [ "vim" ] tags: [ "vim", "completion" ]
--- ---
Complete the word by searching for the *n*ext similar word: 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: Complete the word by searching for a *p*revious similar word:
> C-p `C-p`
Complete the full line: Complete the full line:
> C-x C-l `C-x C-l`

View File

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

View File

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

View File

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

View File

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