[Translation]
"Finding empty linesSearch for empty rows
/^/N/{3}: Find 3 empty lines
Search 3Empty row
[Annotation]
: Help // n
This regular expression matches three consecutive empty rows, that is, there are three consecutive linefeeds at the beginning of the row.
"/N" matches the line break.
[Translation]
"Using rexexp memory in a search
"Store with regular expressions in search
// (Fred/). */(JOE/). */2. */1
[Annotation]
: Help // 1
: Help // 2
In this regular expression, "/1" indicates the same string as the sub-expression of the first "/(/)", and "/2" indicates 2nd, "/3" is 3rd, and so on until "/9 ".
For this example, it is equivalent to "Fred. * Joe. * Joe. * Fred ".
However, the regular expression "/([ABC]/{3 }/). */1 "is not equivalent to" [ABC]/{3 }. * [ABC]/{3 }".
Because "/1" indicates the content matched by the first "/(/)", if the first "/(/)" matches "ABC ", "/1" indicates "ABC". If the first "/(/)" matches "ABB", "/1" indicates "ABB ".
Obviously, the regular expression "[ABC]/{3}. * [ABC]/{3}" does not mean this.
[Translation]
"Repeating the Regexp (rather than what the Regexp finds)
"Repeat the regular expression (no matter what the regular expression looks)
/^/([^,] *,/)/{8}
[Annotation]
This regular expression repeats the elements of "/(/)" eight times, that is, it is equivalent to searching for "^ ([^,] *, ([^,] *, ([^,] *, ([^,] *, ([^,] *, ([^,] *, ([^,] *, ([^,] *) *,".
"([^,] *," Indicates any character other than "," followed by a ",".
[Translation]
"Visual searching
"Search in visual mode
: Vmap // y/<C-R> "<CR>: Search for visually highlighted text
Search for highlighted text
: Vmap <silent> // y/<C-R> = escape (@ ", '//. * $ ^ ~ [] ') <CR>: With spec chars
Highlighted text contains special characters
[Annotation]
: Help v
These two key mappings are used to find highlighted text in visual mode. If highlighted text contains special characters, you need to use the key ing in the two formats.
(Using either of the two) after ing, when you use V or V to select a piece of text, then press "//" to find the text.
The second ing is used as an example to explain:
: Help vmap
VmapDefine a virsualKey ing
: Help map-<silent>
<Silent>This ing is not displayed
: Help y
YCopy the selected content to the anonymous register
/Start search
: Help c_CTRL-R _ =
C-R> = The search content comes from the result of an expression.
: Help escape ()
Escape ()Set parameter 1The special characters in (By parameter 2Specified)Add an escape character before/
: Help registers
: Help expr-register
@" Indicates the content in the unknown register.
'//. * $ ^ ~ []'PairThisEscape some special characters
: Help key-notation
<CR> Enter
[Reference]
1. http://www.rayninfo.co.uk/vimtips.html
2. http://groups.google.com/group/Vim-cn/msg/f72fba0645955101?
3. Vim Help File
4. http://vimcdoc.sourceforge.net/
[Note]
This article can be freely used for non-commercial purposes. Indicate the source for reprinting.
Link: http://blog.csdn.net/easwy