edit vim
This commit is contained in:
parent
7e4ac7c7b1
commit
317dbb6a5a
@ -1,15 +1,12 @@
|
|||||||
---
|
---
|
||||||
title: "vim basics"
|
title: "vim basics"
|
||||||
tags: [ "Documentation", "vim" ]
|
tags: [ "Documentation", "vim", "basic" ]
|
||||||
---
|
---
|
||||||
|
|
||||||
Insert text by pressing `i`.
|
1. Insert text by pressing `i`.
|
||||||
|
1. Stop inserting text by pressing `Ctrl+[`.
|
||||||
Stop inserting text by pressing `Ctrl+[`.
|
1. Exit with `ZZ`.
|
||||||
|
1. Congratulations, you now know `vim`.
|
||||||
Exit with `ZZ`.
|
|
||||||
|
|
||||||
Congratulations, you now know `vim`.
|
|
||||||
|
|
||||||
## Extras
|
## Extras
|
||||||
|
|
||||||
|
@ -30,6 +30,11 @@ Go to the last and previous places you've changed:
|
|||||||
|
|
||||||
> g,
|
> g,
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
`source ~/.vimrc`
|
||||||
|
|
||||||
# Project Structure
|
# Project Structure
|
||||||
|
|
||||||
Make a 20 character 'visual split' in the current working directory ('`.`').
|
Make a 20 character 'visual split' in the current working directory ('`.`').
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
title: "vim search"
|
title: "vim search"
|
||||||
tags: [ "Documentation", "vim" ]
|
tags: [ "Documentation", "vim" ]
|
||||||
---
|
---
|
||||||
|
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/
|
||||||
@ -10,3 +12,11 @@ Same, but replace 'one' globally:
|
|||||||
|
|
||||||
> :%s/one/two/g
|
> :%s/one/two/g
|
||||||
|
|
||||||
|
Put quotes around every occurrence of `$HOME`:
|
||||||
|
|
||||||
|
> :%s/$HOME/"&"
|
||||||
|
|
||||||
|
Same, but add curly brackets around `$HOSTNAME`:
|
||||||
|
|
||||||
|
> :%s/$HOSTNAME/{&}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user