Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing Many Files
      Changing Text
         . . .
         Rectangle Commands
         Capitalization
         Replacing
         Regular Expressions
         Rearranging
         . . .
      Language Modes
         Asm Mode
         Batch Mode
         C Mode
         . . .
         Visual Basic Mode
      . . .

Previous   Up    Next
Capitalization  Commands by Topic   Regular Expressions


Epsilon User's Manual and Reference > Commands by Topic > Changing Text >

Replacing

The key Alt-& runs the command replace-string, and allows you to change all occurrences of a string in the rest of your document to another string. Epsilon prompts for the string to replace, and what to replace it with. Terminate the strings with <Enter>. After you enter both strings, Epsilon replaces all occurrences of the first string after point with instances of the second string (but respecting any narrowing restriction; see Miscellaneous).

When entering the string to search for, you can use any of the searching subcommands described in Searching: Ctrl-c toggles case-folding, Ctrl-w toggles word searching, and Ctrl-t toggles interpreting the string as a regular expression.

To enter special characters in either the search or replace strings, use Ctrl-q before each. Type Ctrl-q Ctrl-c to include a Ctrl-c character. Type Ctrl-q Ctrl-j to include a <Newline> character in a search string or replacement text. Press Alt-g when entering the replacement string to copy the search string.

The key Alt-r runs the command query-replace, which works like replace-string. Instead of replacing everything automatically, however, the command positions point after each occurrence of the old string and waits for you to press a key. You may choose whether to replace this occurrence or not:

y or Y or <Space>
Replace it, go on to next occurrence.

n or N or <Backspace>
Don't replace it, go on to next occurrence.

!
Replace all remaining occurrences. The replace-string command works like the query-replace command followed by pressing "!" when it shows you the first match.

<Esc>
Exit and leave point at the match in the buffer.

^
Back up to the previous match.

<Period>
Replace this occurrence and then exit.

<Comma>
Replace and wait for another command option without going on to the next match.

Ctrl-r
Enter a recursive edit. Point and mark go around the match. You may edit arbitrarily. When you exit the recursive edit with Ctrl-x Ctrl-z, Epsilon restores the old mark, and the query-replace continues from the current location.

Ctrl-g
Exit and restore point to its original location.

Ctrl-t
Toggle regular expression searching. See the next section for an explanation of regular expressions.

Ctrl-w
Toggle word searching.

Ctrl-c
Toggle case folding.

? or help key
Provide help, including a list of these options.

anything else
Exit the replacement, staying at the current location, and execute this key as a command.

The command regex-replace operates like query-replace, but starts up in regular expression mode. See Regular Expression Commands.

The command reverse-replace operates like query-replace, but moves backwards. You can also trigger a reverse replacement by pressing Ctrl-r while entering the search text for any of the replacing commands.

If you invoke any of the replacing commands above with a numeric argument, Epsilon will use word searching.

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

Replace commands preserve case. Epsilon examines the case of each match. If a match is entirely upper case, or all words are capitalized, Epsilon makes the replacement text entirely upper case or capitalized, as appropriate. Epsilon only does this when searching is case-insensitive, and neither the search string nor the replace string contain upper case letters. For example, if you search for the regular expression welcome|hello and replace it with greetings, Epsilon replaces HELLO with GREETINGS and Welcome with Greetings. See the replace-by-case variable to alter the rules Epsilon uses. With a regular expression replace, you can force parts of the replacement to a particular case; see Regular Expression Commands.

The file-query-replace command on Shift-F7 replaces text in multiple files. It prompts for the search text, replacement text, and a file name which may contain wildcards. You can use extended file patterns to replace in files from multiple directories; see Extended file patterns. Epsilon skips over any file with an extension listed in grep-ignore-file-extensions or meeting other criteria, just like the grep command. See Searching Multiple Files for details. To search without replacing, see the grep command in Searching Multiple Files.

With a numeric argument, this command searches through buffers instead of files. Instead of prompting for a file name pattern, Epsilon prompts for a buffer name pattern, and only operates on those buffers whose names match that pattern. Buffer name patterns use a simplified file name pattern syntax: * matches zero or more characters, ? matches any single character, and character classes like [a-z] may be used too.

The command delete-matching-lines prompts for a regular expression pattern. It then deletes all lines after point in the current buffer that contain the pattern. The similar command keep-matching-lines deletes all lines except those that contain the pattern. As with any searching command, you can press Ctrl-t, Ctrl-w, or Ctrl-c while typing the pattern to toggle regular expression mode, word mode, or case folding (respectively).

When you select a replacing command from the menu or tool bar (rather than via a command's keyboard binding), Epsilon for Windows runs the dialog-replace or dialog-regex-replace command, to display a replace dialog. Controls on the dialog replace many of the keys described above.

Standard bindings:

  Alt-&  replace-string
 Alt-r, Alt-%  query-replace
 Shift-F7  file-query-replace
 Alt-*  regex-replace
   reverse-replace
   delete-matching-lines
   keep-matching-lines
 



Previous   Up    Next
Capitalization  Commands by Topic   Regular Expressions


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