Next: , Previous: , Up: Stand-alone GNU Info   [Contents][Index]


6 Searching an Info File

GNU Info allows you to search for a sequence of characters throughout an entire Info file. Here are the commands to do this:

s (search)
/

Read a string in the echo area and search for it, either as a regular expression (by default) or a literal string. If the string includes upper-case characters, the Info file is searched case-sensitively; otherwise Info ignores the letter case. With a numeric argument of N, search for Nth occurrence of the string. Negative arguments search backwards.

? (search-backward)

Read a string in the echo area and search backward through the Info file for that string. If the string includes upper-case characters, the Info file is searched case-sensitively; otherwise Info ignores the letter case. With a numeric argument of N, search for Nth occurrence of the string. Negative arguments search forward.

C-x n (search-next)
}

Search forwards for the string used for the last search command. Case sensitivity and use of regular expressions are kept the same. With a numeric argument of n, search for nth next occurrence.

By default, the search starts at the position immediately following the cursor. However, if the variable search-skip-screen (see search-skip-screen) is set, it starts at the beginning of the next page, thereby skipping all visibly displayed lines.

C-x N (search-previous)
{

Just like search-next, but in reverse. You can use search-next and search-previous together to move forward and backward through matches. search-previous usually goes to the place in the file that was displayed before an immediately preceding search-next, and vice versa.3

R (toggle-regexp)

Toggle between using regular expressions and literal strings for searching. Info uses so-called ‘extended’ regular expression syntax (see Regular Expressions in GNU Grep).

S (search-case-sensitively)

Read a string in the echo area and search for it case-sensitively, even if the string includes only lower-case letters. With a numeric argument of N, search for Nth occurrence of the string. Negative arguments search backwards.

C-s (isearch-forward)

Interactively search forward through the Info file for a string as you type it. If the string includes upper-case characters, the search is case-sensitive; otherwise Info ignores the letter case.

C-r (isearch-backward)

Interactively search backward through the Info file for a string as you type it. If the string includes upper-case characters, the search is case-sensitive; otherwise Info ignores the letter case.

M-/ (tree-search)

Recursively search this node and any subnodes listed in menus for a string.

M-} (tree-search-next)
M-{ (tree-search-previous)

Go forwards and backwards through the matches for an active tree search.

The most basic searching command is ‘s’ or ‘/’ (search). The ‘s’ command prompts you for a string in the echo area, and then searches the remainder of the Info file for an occurrence of that string. If the string is found, the node containing it is selected, and the cursor is left positioned at the start of the found string. Subsequent ‘s’ commands show you the default search string; pressing RET instead of typing a new string will use the default search string.

Incremental searching is similar to basic searching, but the string is looked up while you are typing it, instead of waiting until the entire search string has been specified.

The tree search can be used from the dir node to search through all Info files installed on the system. It can also be used to search through a particular chapter of a manual when you are not interested in matches in other chapters.

If the highlight-searches variable is set, matches from search commands will be highlighted. See highlight-searches. Use the M-x clear-search command to clear any search highlights.

Both incremental and non-incremental search by default ignore the case of letters when comparing the Info file text with the search string. However, an uppercase letter in the search string makes the search case-sensitive. You can force a case-sensitive non-incremental search, even for a string that includes only lower-case letters, by using the ‘S’ command (search-case-sensitively). The ‘n’ and ‘N’ commands operate case-sensitively if the last search command was ‘S’.

Normally, the search pattern should not be shorter than some predefined limit. By default, this limit is set to 1 character. See min-search-length for more information on this.


Footnotes

(3)

This sometimes doesn’t happen when search-skip-screen is On, and the search goes across nodes.


Next: Index Commands, Previous: Selecting a Node, Up: Stand-alone GNU Info   [Contents][Index]