Home Explore Blog CI



neovim

5th chunk of `runtime/doc/usr_27.txt`
e12b56543e5f4acfd0cde61c2445b122d94af199293e00aa0000000100000b0e
 included.  Example: >

	/"[^"]*"
<
	 "	  a double quote
	  [^"]	  any character that is not a double quote
	      *	  as many as possible
	       "  a double quote again

This matches "foo" and "3!x", including the double quotes.


PREDEFINED RANGES

A number of ranges are used very often.  Vim provides a shortcut for these.
For example: >

	/\a

Finds alphabetic characters.  This is equal to using "/[a-zA-Z]".  Here are a
few more of these:

	item	matches			equivalent ~
	\d	digit			[0-9]
	\D	non-digit		[^0-9]
	\x	hex digit		[0-9a-fA-F]
	\X	non-hex digit		[^0-9a-fA-F]
	\s	white space		[ 	]     (<Tab> and <Space>)
	\S	non-white characters	[^ 	]     (not <Tab> and <Space>)
	\l	lowercase alpha		[a-z]
	\L	non-lowercase alpha	[^a-z]
	\u	uppercase alpha		[A-Z]
	\U	non-uppercase alpha	[^A-Z]

	Note:
	Using these predefined ranges works a lot faster than the character
	range it stands for.
	These items can not be used inside [].  Thus "[\d\l]" does NOT work to
	match a digit or lowercase alpha.  Use "\(\d\|\l\)" instead.

See |/\s| for the whole list of these ranges.

==============================================================================
*27.7*	Character classes

The character range matches a fixed set of characters.  A character class is
similar, but with an essential difference: The set of characters can be
redefined without changing the search pattern.
   For example, search for this pattern: >

	/\f\+

The "\f" item stands for file name characters.  Thus this matches a sequence
of characters that can be a file name.
   Which characters can be part of a file name depends on the system you are
using.  On MS-Windows, the backslash is included, on Unix it is not.  This is
specified with the 'isfname' option.  The default value for Unix is: >

	:set isfname
	isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=

For other systems the default value is different.  Thus you can make a search
pattern with "\f" to match a file name, and it will automatically adjust to
the system you are using it on.

	Note:
	Actually, Unix allows using just about any character in a file name,
	including white space.  Including these characters in 'isfname' would
	be theoretically correct.  But it would make it impossible to find the
	end of a file name in text.  Thus the default value of 'isfname' is a
	compromise.

The character classes are:

	item	matches				option ~
	\i	identifier characters		'isident'
	\I	like \i, excluding digits
	\k	keyword characters		'iskeyword'
	\K	like \k, excluding digits
	\p	printable characters		'isprint'
	\P	like \p, excluding digits
	\f	file name characters		'isfname'
	\F	like \f, excluding digits

==============================================================================
*27.8*	Matching a line break

Vim can find a pattern that includes a line break.  You need to specify where
the

Title: Complemented Ranges, Predefined Ranges, and Character Classes in Vim Patterns
Summary
This section discusses complemented ranges (using '^'), predefined ranges (like '\d' for digits), and character classes (like '\f' for filename characters) in Vim patterns. Character classes adapt to the system, using options like 'isfname' to define character sets, making searches system-aware.