diff --git a/vim/basic_vim.md b/vim/basic_vim.md index ebb4fae..87c80fa 100644 --- a/vim/basic_vim.md +++ b/vim/basic_vim.md @@ -1,15 +1,12 @@ --- title: "vim basics" -tags: [ "Documentation", "vim" ] +tags: [ "Documentation", "vim", "basic" ] --- -Insert text by pressing `i`. - -Stop inserting text by pressing `Ctrl+[`. - -Exit with `ZZ`. - -Congratulations, you now know `vim`. +1. Insert text by pressing `i`. +1. Stop inserting text by pressing `Ctrl+[`. +1. Exit with `ZZ`. +1. Congratulations, you now know `vim`. ## Extras diff --git a/vim/navigate.md b/vim/navigate.md index 937f1a4..cdd6e2e 100644 --- a/vim/navigate.md +++ b/vim/navigate.md @@ -30,6 +30,11 @@ Go to the last and previous places you've changed: > 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 Make a 20 character 'visual split' in the current working directory ('`.`'). diff --git a/vim/vim-search.md b/vim/vim-search.md index 237a512..bc6fe7f 100644 --- a/vim/vim-search.md +++ b/vim/vim-search.md @@ -2,6 +2,8 @@ title: "vim search" 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': > :%s/one/two/ @@ -10,3 +12,11 @@ Same, but replace 'one' globally: > :%s/one/two/g +Put quotes around every occurrence of `$HOME`: + +> :%s/$HOME/"&" + +Same, but add curly brackets around `$HOSTNAME`: + +> :%s/$HOSTNAME/{&} +