diff --git a/pages/common/vim.md b/pages/common/vim.md index 012caf7713..ba1d4f4458 100644 --- a/pages/common/vim.md +++ b/pages/common/vim.md @@ -1,7 +1,7 @@ # vim > Vi IMproved, a programmer's text editor, providing several modes for different kinds of text manipulation. -> Pressing `i` enters edit mode; the normal mode (accessed via ``) doesn't allow regular text editing. +> Pressing `i` enters edit mode. `` goes back to normal mode, which doesn't allow regular text insertion. - Open a file: @@ -9,24 +9,28 @@ - Enter text editing mode (insert mode): -` i` +`i` - Copy ("yank") or cut ("delete") the current line (paste it with `P`): -` {{yy|dd}}` +`{{yy|dd}}` - Undo the last operation: -` u` +`u` -- Search for a pattern in the file (press `n` to go to the next result): +- Search for a pattern in the file (press `n`/`N` to go to next/previous match): -` /{{search_pattern}} ` +`/{{search_pattern}}` - Perform a regex substitution in the whole file (from the start, `1`, to the end, `$`): -` :1,$s/{{pattern}}/{{replacement}}/g ` +`:1,$s/{{pattern}}/{{replacement}}/g` -- Save (write) the file, and quit vim: +- Save (write) the file, and quit: -` :wq ` +`:wq` + +- Quit without saving: + +`:q!`