Home Explore Blog CI



neovim

23th chunk of `runtime/doc/editing.txt`
458191b44b95ffa962de9531a5e4ee6a5cb2ad2d979400f10000000100000999
 day.

==============================================================================
11. File Searching					*file-searching*

The file searching is currently used for the 'path', 'cdpath' and 'tags'
options, for |finddir()| and |findfile()|.  Other commands use |wildcards|
which is slightly different.

There are three different types of searching:

1) Downward search:					*starstar*
   Downward search uses the wildcards "*", "**" and possibly others
   supported by your operating system.  "*" and "**" are handled inside Vim,
   so they work on all operating systems.  Note that "**" only acts as a
   special wildcard when it is at the start of a name.

   The usage of "*" is quite simple: It matches 0 or more characters.  In a
   search pattern this would be ".*".  Note that the "." is not used for file
   searching.

   "**" is more sophisticated:
      - It ONLY matches directories.
      - It matches up to 30 directories deep by default, so you can use it to
	search an entire directory tree
      - The maximum number of levels matched can be given by appending a number
	to "**".
	Thus '/usr/**2' can match: >
		/usr
		/usr/include
		/usr/include/sys
		/usr/include/g++
		/usr/lib
		/usr/lib/X11
		....
<	It does NOT match '/usr/include/g++/std' as this would be three
	levels.
	The allowed number range is 0 ("**0" is removed) to 100
	If the given number is smaller than 0 it defaults to 30, if it's
	bigger than 100 then 100 is used.  The system also has a limit on the
	path length, usually 256 or 1024 bytes.
      - "**" can only be at the end of the path or be followed by a path
	separator or by a number and a path separator.

   You can combine "*" and "**" in any order: >
	/usr/**/sys/*
	/usr/*tory/sys/**
	/usr/**2/sys/*

2) Upward search:
   Here you can give a directory and then search the directory tree upward for
   a file.  You could give stop-directories to limit the upward search.  The
   stop-directories are appended to the path (for the 'path' option) or to
   the filename (for the 'tags' option) with a ';'.  If you want several
   stop-directories separate them with ';'.  If you want no stop-directory
   ("search upward till the root directory") just use ';'. >
	/usr/include/sys;/usr
<   will search in: >
	   /usr/include/sys
	   /usr/include
	   /usr
<
   If you use a relative path the upward search is started in Vim's current
   directory or in the directory of the current file (if the relative path
 

Title: Vim File Searching: Downward and Upward Search Explained
Summary
This section delves into file searching within Vim, specifically focusing on downward and upward searches. It explains the use of wildcards like '*' and '**' for downward searches, detailing how '**' matches directories up to a specified depth. It also describes how to limit the depth of the search and how to combine '*' and '**' in search patterns. Additionally, the section explains the concept of upward searching, including how to specify stop-directories to limit the search range and the behavior of upward searches with relative paths.