Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      Getting Help
         Info Mode
         Web-based Epsilon Documentation
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
            Searching Multiple Files
         Bookmarks
         Tags
         . . .
      Changing Text
         Inserting and Deleting
         Killing Text
         Clipboard Access
         . . .
         Hex Mode
      . . .

Previous   Up    Next
Parenthetic Expressions  Commands by Topic   Searching Multiple Files


Epsilon User's Manual and Reference > Commands by Topic > Moving Around >

Searching

Epsilon provides a set of flexible searching commands that incorporate incremental search. In the incremental-search command, Epsilon searches as you type the search string. Ctrl-s begins an incremental search forward, and Ctrl-r starts one in reverse. Any character that normally inserts itself into the buffer becomes part of the search string. In an incremental search, Ctrl-s and Ctrl-r find the next occurrence of the string in the forward and reverse directions, respectively. With an empty search string, Ctrl-s or Ctrl-r will either reverse the direction of the search, or bring in the previously used search string. (To retrieve older search strings, see Command History.)

You can use <Backspace> to remove characters from the search string, and enter control characters and meta characters (characters with the eighth bit set) in the search string by quoting them with Ctrl-q. (Type Ctrl-q Ctrl-j to search for a <Newline> character.) Use the Ctrl-g abort command to stop a long search in progress.

Typing <Enter> or <Esc> exits from an incremental search, makes Epsilon remember the search string, and leaves point at the match in the buffer.

While typing characters into the search string for incremental-search, a Ctrl-g quits and moves point back to the place the search started, without changing the default search string. During a failing search, however, Ctrl-g simply removes the part of the string that did not match.

If you type an editing key not mentioned in this section, Epsilon exits the incremental search, then executes the command bound to the key.

You can make Epsilon copy search text from the current buffer by typing Alt-<Down>. Epsilon will append the next word from the buffer to the current search string. This is especially convenient when you see a long variable name, and you want to search for other references to it. (It's similar to setting the mark and moving forward one word with Alt-f, then copying the text to a kill buffer and yanking it into the current search string.) Similarly, Alt-<PageDown> appends the next line from the current buffer to the search string. These two keys are actually available at almost any Epsilon prompt, though they're especially useful when searching. Alt-Ctrl-n and Alt-Ctrl-v are synonyms for Alt-<Down> and Alt-<PageDown>, respectively.

While Alt-<Down> and Alt-<PageDown> copy text from the buffer at point, using the word pulling keys F3, Ctrl-<Up> or Ctrl-<Down> copies text into the search string from other parts of the buffer; see Pulling Words.

You can change how Epsilon interprets the search string by pressing certain keys when you type in the search string. Pressing the key a second time restores the original interpretation of the search string.

  • Pressing Ctrl-c toggles the state of case folding. While case folding, Epsilon considers upper case and lower case the same when searching, so a search string of "Word" would match "word" and "WORD" as well.

    Epsilon remembers the state of case folding for each buffer separately, using the buffer-specific variable case-fold. When you start to search, Epsilon sets its default for case folding based on that variable's value for the current buffer. Toggling case folding with Ctrl-c won't affect the default. Use the toggle-case-fold command to do this, or set the case-fold variable using the set-variable command described in Variables to change the default for case folding.

  • Pressing Ctrl-w toggles word searching. During word searching, Epsilon only looks for matches consisting of complete words. For instance, word searching for "a" in this sentence finds only one match (the one in quotes), but five when not doing word searching. You can type multiple words separated by spaces, and Epsilon will recognize them no matter what whitespace characters separate them (for instance, if they're on successive lines).

  • Pressing Ctrl-t makes Epsilon interpret the search string as a regular expression search pattern, as described in Regular Expressions. Another Ctrl-t turns off this interpretation. If the current search string denotes an invalid regular expression, Epsilon displays "Bad R-E Search: <string>" instead of its usual message "R-E Search: <string>" (where <string> refers to the search string). (When word and regular expression modes are combined, the entire pattern must start and end on a word boundary. Use </word> to match word boundaries within it.)

  • Pressing Ctrl-o toggles incremental searching. In an incremental search, most editing commands will exit the search, as described above. But you may want to edit the search string itself. If you turn off the "incremental" part of incremental search with the Ctrl-o key, Epsilon will let you use the normal editing keys to modify the search string.

    In non-incremental mode, Epsilon won't automatically search after you type each character, but you can tell it to find the next match by typing Ctrl-s or Ctrl-r (depending on the direction). This performs the search but leaves you in search mode, so you can find the next occurrence of the search string by typing Ctrl-s or Ctrl-r again. When you press <Enter> to exit from the search, Epsilon will search for the string you've entered, unless you've just searched with Ctrl-s or Ctrl-r. (In general, the <Enter> key causes a search if the cursor appears in the echo area. If, on the other hand, the cursor appears in a window showing you a successful search, then typing the <Enter> key simply stops the search.) A numeric argument of n to a non-incremental search will force Epsilon to find the nth occurrence of the indicated string.

Epsilon interprets the first character you type after starting a search with Ctrl-s or Ctrl-r a little differently. Normally, Ctrl-s starts an incremental search, with regular expression searching and word searching both disabled. If you type Ctrl-t or Ctrl-w to turn one of these modes on, Epsilon will also turn off incremental searching. Epsilon also pulls in a default search string differently if you do it immediately. It will always provide the search string from the last search, interpreting the string as it did for that search. If you retrieve a default search string at any other time, Epsilon will provide the last one consistent with the state of regular expression mode (in other words, the last regular expression pattern, if in regular expression mode, or the last non-regular-expression string otherwise).

There are other ways besides Ctrl-s or Ctrl-r to retrieve previous search strings. You can press Alt-<Up> or Ctrl-Alt-p to display a list of previous search patterns. Press <Enter> to select one. Or you can press Alt-g at a search prompt to retrieve the search string from your last search in the current buffer only. This can differ from the default search string you get when you use Ctrl-s or Ctrl-r, since those are not per-buffer.

The Ctrl-Alt-s and Ctrl-Alt-r commands function like Ctrl-s and Ctrl-r, but they start in regular-expression, non-incremental mode. You can also start a plain string search in non-incremental mode using the string-search and reverse-string-search commands. Some people like to bind these commands to Ctrl-s and Ctrl-r, respectively. Also see the search-positions-at-start variable.

Keep in mind that you can get from any type of search to any other type of search by typing the appropriate subcommands to a search. For example, if you meant to do a regex-search but instead typed Ctrl-s to do an incremental search, you could enter regex mode by typing Ctrl-t. The table summarizes the search subcommands.

Ctrl-s or Ctrl-r
Switch to a new direction, or find the next occurrence in the same direction, or pull in the previous search string.

normal key
Add that character to the search string.

<Backspace>
Remove the last character from the search string.

Ctrl-g
Stop a running search, or (in incremental mode) delete characters until the search succeeds, or abort the search, returning to the starting point.

Ctrl-o
Toggle incremental searching.

Ctrl-t
Toggle regular expression searching.

Ctrl-w
Toggle word searching. Matches must consist of complete words.

Ctrl-c
Toggle case folding.

<Enter>
Exit the search.

Ctrl-d or <Del>
Delete the current match and exit the search (but see the search-delete-match variable).

Ctrl-q
Quote the following key, entering it into the search string even if it would normally run a command.

help key
Show the list of search subcommands.

other keys
If in incremental mode, exit the search, then execute the key normally. If not incremental mode, edit the search string.

When you're at the last match of some text in a buffer, and tell incremental search to search again by pressing Ctrl-s, Epsilon displays "Failing" to indicate no more matches. If you press Ctrl-s once more, Epsilon will wrap to the beginning of the buffer and continue searching from there. It will display "Wrapped" to indicate it's done this. If you keep on search, eventually you'll pass your starting point again; then Epsilon will display "Overwrapped" to indicate that it's showing you a match you've already seen. A reverse search works similarly; Epsilon will wrap to the end of the buffer when you keep searching after a search has failed. (You can set the search-wraps variable to zero to disable wrapping.)

In some modes like Info mode, where a buffer displays a single part of some larger collection of text, pressing Ctrl-s at a failing search results in a continued search, instead of wrapping. Epsilon displays "Continued" to indicate (in the case of Info mode) that it's searching through other nodes.

The forward-search-again and reverse-search-again commands search forward and backward (respectively) for the last-searched-for search string, without prompting. The search-again command searches in the same direction as before for the same search string.

The search-region command restricts searching to the current region, which will be highlighted during the search command.

If you highlight a region before searching, Epsilon uses it as an initial search string if it's not very long. Set the search-in-region variable to make Epsilon instead restrict matches it finds to the highlighted region, like the search-region command. Also see the search-defaults-from variable.

You can change the function of most keys in Epsilon by rebinding them (see Bindings). But Epsilon doesn't implement the searching command keys listed above with the normal binding mechanism. The EEL code for searching refers directly to the keys Ctrl-c, Ctrl-w, Ctrl-t, Ctrl-o, Ctrl-q, <Enter>, and <Esc>, so to change the function of these keys within searching you must modify the EEL code in the file search.e. Epsilon looks at your current bindings to determine which keys to use as the help key and backspace key. It looks at the abort_key variable to determine what to use as your abort key, instead of Ctrl-g. (See Interrupting a Command.) Epsilon always recognizes Ctrl-s and Ctrl-r as direction keys, but you can set two variables fwd-search-key and rev-search-key to key codes. These will then act as "synonyms" to Ctrl-s and Ctrl-r, respectively.

When you select a searching command from the menu or tool bar (rather than via a command's keyboard binding), Epsilon for Windows runs the dialog-search or dialog-reverse-search command, to display a search dialog.

Most of the keys described above also work in dialog-based searching. However, dialog searching is never incremental, so Ctrl-o doesn't toggle incremental searching in a dialog. And Ctrl-q doesn't quote the following character, because dialog searching doesn't support directly entering special characters.

To match special characters in dialog-based searching, you can enable regular expression searching, and then enter them using syntax like <Tab> or <#13>. See Entering Special Characters. In replacement text, add a # first, as in #<Newline> or #<#13>. See Regular Expression Commands.

Standard bindings:

  Ctrl-s  incremental-search
 Ctrl-r  reverse-incremental-search
 Ctrl-Alt-s  regex-search
 Ctrl-Alt-r  reverse-regex-search
   string-search
   reverse-string-search
   search-again
   forward-search-again
   reverse-search-again
   search-region
   dialog-search
   dialog-reverse-search
   toggle-case-fold
 

Subtopics:

Searching Multiple Files



Previous   Up    Next
Parenthetic Expressions  Commands by Topic   Searching Multiple Files


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.