Home Explore Blog CI



neovim

2nd chunk of `runtime/doc/pattern.txt`
a64cf43a6beca97b9628c1bf4232eb6db936d8b49b7728880000000100000fa5
	Like "#", but don't put "\<" and "\>" around the word.
			This makes the search also find matches that are not a
			whole word.

							*gd*
gd			Goto local Declaration.  When the cursor is on a local
			variable, this command will jump to its declaration.
			This was made to work for C code, in other languages
			it may not work well.
			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|.
			After this command |n| searches forward for the next
			match (not backward).

							*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.

							*1gd*
1gd			Like "gd", but ignore matches inside a {} block that
			ends before the cursor position.

							*1gD*
1gD			Like "gD", but ignore matches inside a {} block that
			ends before the cursor position.

							*CTRL-C*
CTRL-C			Interrupt current (search) command.
			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|.
			Same thing for when invoking a user function.


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 search
command with <CR> to actually position the cursor at the displayed match.  Or
use <Esc> to abandon the search.

							*nohlsearch-auto*
All matches for the last used search pattern will be highlighted if you set
the 'hlsearch' option.  This can be suspended with the |:nohlsearch| command
or auto suspended with nohlsearch plugin.  See |nohlsearch-install|.


When 'shortmess' does not include the "S" flag, Vim will automatically show an
index, on which the cursor is.  This can look like this: >

  [1/5]		Cursor is on first of 5 matches.
  [1/>99]	Cursor is on first of more than 99 matches.
  [>99/>99]	Cursor is after 99 match of more than 99 matches.
  [?/??]	Unknown how many matches exists, generating the
		statistics was aborted because of search timeout.

Note: the count does not take offset into account.

When no match is found you get the error: *E486* Pattern not found
Note that for the `:global` command, you get a normal message "Pattern not
found", for Vi compatibility.
For the |:s| command the "e" flag can be used to avoid the error message
|:s_flags|.

					*search-offset* *{offset}*
These commands search for the specified pattern.  With "/" and "?" an
additional offset may be given.  There are two types of offsets: line offsets
and character offsets.

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] identical to s[+num] above (mnemonic: begin)
    b[-num]	[num] identical to s[-num] above

Title: Vim: Goto Declaration, Interrupting Search, and Search Offsets
Summary
This section covers the 'gd' and 'gD' commands for navigating to local and global variable declarations, respectively. It also describes how to interrupt search commands (CTRL-C), stop search highlighting (:nohlsearch), and how to specify search offsets to position the cursor relative to a found match using line and character offsets.