⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pattern.txt

📁 MSYS在windows下模拟了一个类unix的终端
💻 TXT
📖 第 1 页 / 共 2 页
字号:
*pattern.txt*   For Vim version 5.8.  Last change: 2000 Sep 21		  VIM REFERENCE MANUAL    by Bram MoolenaarPatterns and search commands				*pattern-searches*1. Search commands		|search-commands|2. The definition of a pattern	|search-pattern|==============================================================================1. Search commands					*search-commands*							*/*/{pattern}[/]<CR>	Search forward for the [count]'th occurrence of			{pattern} (exclusive)./{pattern}/{offset}<CR>	Search forward for the [count]'th occurrence of			{pattern} and go |{offset}| lines up or down.			(linewise).							*/<CR>*/<CR>			Search forward for the [count]'th latest used			pattern |last-pattern| with latest used |{offset}|.//{offset}<CR>		Search forward for the [count]'th latest used			pattern |last-pattern| with new |{offset}|.  If			{offset} is empty no offset is used.							*?*?{pattern}[?]<CR>	Search backward for the [count]'th previous			occurrence of {pattern} (exclusive).?{pattern}?{offset}<CR>	Search backward for the [count]'th previous			occurrence of {pattern} and go |{offset}| lines up or			down (linewise).							*?<CR>*?<CR>			Search backward for the [count]'th latest used			pattern |last-pattern| with latest used |{offset}|.??{offset}<CR>		Search backward for the [count]'th latest used			pattern |last-pattern| with new |{offset}|.  If			{offset} is empty no offset is used.							*n*n			Repeat the latest "/" or "?" [count] times.			|last-pattern| {Vi: no count}							*N*N			Repeat the latest "/" or "?" [count] times in			opposite direction. |last-pattern| {Vi: no count}							*star**			Search forward for the [count]'th occurrence of the			word nearest to the cursor.  The word used for the			search is the first of:				1. the keyword under the cursor |'iskeyword'|				2. the first keyword after the cursor, in the				   current line				3. the non-blank word under the cursor				4. the first non-blank word after the cursor,				   in the current line			Only whole keywords are searched for, like with the			command "/\<keyword\>".  (exclusive)  {not in Vi}							*#*#			Same as "*", but search backward.  The pound sign			(character 163) also works.  If the "#" key works as			backspace, try using "stty erase <BS>" before starting			Vim (<BS> is CTRL-H or a real backspace).  {not in Vi}							*gstar*g*			Like "*", but don't put "\<" and "\>" around the word.			This makes the search also find matches that are not a			whole word.  {not in Vi}							*g#*g#			Like "#", but don't put "\<" and "\>" around the word.			This makes the search also find matches that are not a			whole word.  {not in Vi}							*gd*gd			Goto local Declaration.  When the cursor is on a local			variable, this command will jump to its declaration.			First Vim searches for the start of the current			function, just like "[[".  If it is not found the			search stops in line 1.  If it is found, Vim goes back			until a blank line is found.  From this position Vim			searches for the keyword under the cursor, like with			"*", but lines that look like a comment are ignored			(see 'comments' option).			Note that this is not guaranteed to work, Vim does not			really check the syntax, it only searches for a match			with the keyword.  If included files also need to be			searched use the commands listed in |include-search|.			{not in Vi}							*gD*gD			Goto global Declaration.  When the cursor is on a			global variable that is defined in the file, this			command will jump to its declaration.  This works just			like "gd", except that the search for the keyword			always starts in line 1.  {not in Vi}							*CTRL-C*CTRL-C			Interrupt current (search) command.  Use CTRL-Break on			MS-DOS |dos-CTRL-Break|.			In Normal mode, any pending command is aborted.							*:noh* *:nohlsearch*:noh[lsearch]		Stop the highlighting for the 'hlsearch' option.  It			is automatically turned back on when using a search			command, or setting the 'hlsearch' option.			This command doesn't work in an autocommand, because			the highlighting state is saved and restored when			executing autocommands |autocmd-searchpat|.While typing the search pattern the current match will be shown if the'incsearch' option is on.  Remember that you still have to finish the searchcommand with <CR> to actually position the cursor at the displayed match.  Oruse <Esc> to abandon the search.All matches for the last used search pattern will be highlighted if you setthe 'hlsearch' option.  This can be suspended with the |:nohlsearch| command.					*search-offset* *{offset}*These commands search for the specified pattern.  With "/" and "?" anadditional offset may be given.  There are two types of offsets: line offsetsand character offsets.  {the character offsets are not in Vi}The offset gives the cursor position relative to the found match:    [num]	[num] lines downwards, in column 1    +[num]	[num] lines downwards, in column 1    -[num]	[num] lines upwards, in column 1    e[+num]	[num] characters to the right of the end of the match    e[-num]	[num] characters to the left of the end of the match    s[+num]	[num] characters to the right of the start of the match    s[-num]	[num] characters to the left of the start of the match    b[+num]	[num] characters to the right of the start (begin) of the match    b[-num]	[num] characters to the left of the start (begin) of the matchIf a '-' or '+' is given but [num] is omitted, a count of one will be used.When including an offset with 'e', the search becomes inclusive (thecharacter the cursor lands on is included in operations).Examples:pattern			cursor position	~/test/+1		one line below "test", in column 1/test/e			on the last t of "test"/test/s+2		on the 's' of "test"/test/b-3		three characters before "test"If one of these commands is used after an operator, the characters betweenthe cursor position before and after the search is affected.  However, if aline offset is given, the whole lines between the two cursor positions areaffected.							*//;*A very special offset is ';' followed by another search command.  For example:>  /test 1/;/test>  /test.*/+1;?ing?The first one first finds the next occurrence of "test 1", and then the firstoccurrence of "test" after that.This is like executing two search commands after each other, except that:- It can be used as a single motion command after an operator.- The direction for a following "n" or "N" command comes from the first  search command.- When an error occurs the cursor is not moved at all.							*last-pattern*The last used pattern and offset are remembered.  They can be used to repeatthe search, possibly in another direction or with another count.  Note thattwo patterns are remembered: One for 'normal' search commands and one for thesubstitute command ":s".  Each time an empty pattern is given, the previouslyused pattern is used.The 'magic' option sticks with the last used pattern.  If you change 'magic',this will not change how the last used pattern will be interpreted.The 'ignorecase' option does not do this.  When 'ignorecase' is changed, itwill result in the pattern to match other text.All matches for the last used search pattern will be highlighted if you setthe 'hlsearch' option.In Vi the ":tag" command sets the last search pattern when the tag is searchedfor.  In Vim this is not done, the previous search pattern is still remembered,unless the 't' flag is present in 'cpoptions'.  The search pattern is alwaysput in the search history.If the 'wrapscan' option is on (which is the default), searches wrap aroundthe end of the buffer.  If 'wrapscan' is not set, the backward search stopsat the beginning and the forward search stops at the end of the buffer.  If'wrapscan' is set and the pattern was not found the error message "patternnot found" is given, and the cursor will not be moved.  If 'wrapscan' is notset the message becomes "search hit BOTTOM without match" when searchingforward, or "search hit TOP without match" when searching backward.  Ifwrapscan is set and the search wraps around the end of the file the message"search hit TOP, continuing at BOTTOM" or "search hit BOTTOM, continuing atTOP" is given when searching backwards or forwards respectively.  This can beswitched off by setting the 's' flag in the 'shortmess' option.  The highlightmethod 'w' is used for this message (default: standout).							*search-range*You cannot limit the search command "/" to a certain range of lines.  A trickto do this anyway is to use the ":substitute" command with the 'c' flag.Example:>  :.,300s/Pattern//gcThis command will search from the cursor position until line 300 for"Pattern".  At the match, you will be asked to type a character.  Type 'q' tostop at this match, type 'n' to find the next match.The "*", "#", "g*" and "g#" commands look for a word near the cursor in thisorder, the first one that is found is used:- The keyword currently under the cursor.- The first keyword to the right of the cursor, in the same line.- The WORD currently under the cursor.- The first WORD to the right of the cursor, in the same line.The keyword may only contain letters and characters in 'iskeyword'.The WORD may contain any non-blanks (<Tab>s and/or <Space>s).Note that if you type with ten fingers, the characters are easy to remember:the "#" is under your left hand middle finger (search to the left and up) andthe "*" is under your right hand middle finger (search to the right and down).==============================================================================2. The definition of a pattern		*search-pattern* *pattern* *[pattern]*					*regular-expression* *regexp* *Pattern*Patterns may contain special characters, depending on the setting of the'magic' option.  It is recommended to always use the default setting, which is'magic'.  This avoids portability problems.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -