From 8d93237d63619b68edebb591f9d766d326e4a2d3 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Tue, 11 Oct 2016 22:28:22 -0500 Subject: [PATCH] vim: Normal mode is the normal mode (#1106) * vim: Improvements we can can agree on Remove spaces between keypresses (as it could lead users to think they should type a space there). Simplify regexp substitution example. Add ...then... to search example. Add quit without saving example. * vim: Improvements we can can agree on Move search keystrokes to the example title. Keep original regexp substitution example. See conversation starting at https://github.com/tldr-pages/tldr/pull/1106/commits/ee1472e76f2c3241a2f4bb96a56b824af724c64c#r82820204 --- pages/common/vim.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) 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!`