|
There are a number of ways to search for text in Komodo:
- Incremental Search
quickly finds text in the current buffer
- The Find dialog
box offers several find and replace options.
- The Open/Find
Toolbar can search the current buffer or files in a
project or directory
To replace text, use the Open/Find Toolbar with the
Replace option.
Additional features are available for:
Use incremental search to quickly find a word or string in the file
you are currently editing.
- Start an incremental search: Use the associated
key binding (by
default: 'Ctrl'+'I' on Windows and Linux, 'Cmd'+'I' on Mac OS X).
The status bar displays "Incremental Search:" followed by the
characters in your search. Begin typing the characters you want to
find. As you type, the cursor moves to the first match after the
current cursor position.
- Jump to the next/previous occurrence: Press
'Ctrl'+'I' 'Ctrl'+'I' to cycle through all subsequent occurrences;
press 'Ctrl'+'Shift'+'I' to cycle through previous ones.
- Use a selection as your search string: Select
the text you want to use with the mouse or keyboard, then press
'Ctrl'+'I'.
- Change the search string while searching: Use
'Shift'+'Right Arrow' to add the character to the right of the
current selection, and 'Shift'+'Left Arrow' will remove a
character.
- Cancel the search: Press 'Esc'.
The Find dialog box is a multi-purpose interface for finding and
replacing text. It has the following options:
- Regex: Use regular expressions
instead of plain text.
- Smart case / Match
case: Toggles between "Match case" (selected - case
sensitive), "Match case" (deselected - case insensitive), and "Smart
Case".
- Word: Match whole
words only.
- Multiline:
Changes the "Find what:" field to a multi-line field, allowing you
to insert blocks of text.
- Replace: Adds the "Replace with:" field for
making substitutions.
The interface changes as different options are selected, so that
you only see fields and buttons that are
relevant to your task.
Regex Searches
Selecting Regex will interpret
the search string as a Python regular expression,
and perform the search accordingly.
To the right of the "Find what:" field are two buttons which can
help you compose your regular expression:
- Regular Expression Shortcuts: A drop list of
commonly used regular expression special characters and sequences
with a short description of what each one does.
- Open in Rx Toolkit: Opens the regular
expression from the "Find what:" field in the Rx
Toolkit, allowing you to test it before running your search.
Komodo IDE only
When used in conjunction with Replace, regular
expression replacement sequences can be used in the "Replace with:"
field (e.g. "\1", "\g<name>", etc.).
The Smart case / Match case option is a three-way
toggle:
- Match case (selected): Performs a case
sensitive search; only exact matches are found (e.g. "myString"
matches "myString" but not "mystring").
- Match case (deselected): Performs a case
insensitive search; strings will match even if the case is
different (e.g. "mystring" will match "myString").
- Smart case (selected): Search strings
containing capital letters are automatically case sensitive.
Match Whole Words
With Word selected, search strings will only match
if a whitespace occurs on either side of the string. For example, if
the search string is "edit" and "Word" is selected, only occurrences
of the word "edit" will be found. If it is not selected, "editing",
"editor", "editorial" and "edited" could also be found.
Multiline
Selecting Multiline changes the "Find what:" field
(and the "Replace with:" field if Replace is selected)
with larger, multiline text boxes.
This makes it easier to paste in multiline blocks of text in these
fields. The search text will only match if the line breaks are the
same. Line breaks in the "Replace with:" field are likewise
respected.
Scope
The "Search in:" drop list defines where the find or replace will
happen. It contains the following options:
- Current document
- Selected text
- Open files
- Project (current project)
- Files
Selecting Files from this list opens additional
fields allowing you to set the scope of your search in directories on your filesystem:
- Directories: Defines the path to the directory
to start your search in. Multiple paths can be added by separating
them with a semi-colon (";"). Relative paths can be specified using
the path of the file in the current editor tab as the starting point
(e.g. "../adjacent-dir/").
- Search in sub-directories: If selected, makes
the search recursive. The search starts in the directory or
directories specified above and descends into all
sub-directories.
- Include: Defines the file names to include in
the search or replace. Can be used to specify a partial filename or
file extension with glob syntax (e.g. "*.html, *.txt").
- Exclude: As above, but defining the files and
directories to exclude.
See also the Replace in
Files section for a description of the
Confirm and Undo options.
Once all the options for the Find or Replace are set, choose the
action you wish to perform. The action buttons available will depend
on which options have been selected:
- Find Next: Finds consecutive occurrences
of the search string in your file or selection. As matches are
found, the text will be highlighted. The Find dialog box
remains in focus. To keep the focus in your file, close the
Find dialog box, then use the associated key binding.
- Find All: Locates all occurrences of the search
string in your file or selection. The matches will be displayed in
the Find Results tab in the Bottom
Pane.
- Replace: Highlights the next occurrence of
the search string; if you click Replace again,
the highlighted text will be replaced with the replacement
string and the next occurrence of the search string will be
highlighted.
- Replace All: Replaces all occurrences of
the search string in the document or selection without
prompting for confirmation. All replacements will be displayed
on the Find Results tab
of the Bottom Pane.
- Mark All: Inserts a bookmark on each line
that contains the search string. To move the editing cursor to
a bookmarked line, press 'F2'.
Globally replacing strings in multiple files can be daunting. Using a
search string that matches more than what was intended, specifying an
incorrect replacement string, or selecting the wrong starting
directory for a recursive replacement can cause havoc.
Komodo's Replace in Files feature has a
Confirm option which lets you check the substitutions
before you apply them, and an Undo feature to revert
the replacement if you make a mistake.
When "Search in: Files" is selected, the only action button
available is Replace All. Beneath this button is a
Confirm check box. This option adds an additional
step to the replacement process which allows you to view changes
before applying them, and "un-mark" specific changes you don't want to
apply.
The Confirm Replacements dialog box shows a list of all pending
replacements from the Replace in Files operation.
Each line shows:
- A check mark (by default all are marked) indicating that the
replacements in that file are marked for inclusion. Click on the
check marks to toggle them on or off.
- The path and filename
- The number of replacements to be made in the file
Show Selected Changes previews all
selected changes in the list. Use 'Shift'+'Click' or
'Ctrl'+'Click' to select multiple items.
Show Marked Changes previews all marked
changes.
The preview window has the same format and options as Compare Files. The
preview is in unified diff format, so it can be copied and saved as a
patch.
Once you have confirmed that all pending replacements are correct,
or un-marked the changes you do not want to include, click
Make Changes.
As Komodo makes the replacements, it outputs a log of the changes
in a Find Results tab in the bottom pane. You can click on any of the
changes to open the file in an editor tab at the appropriate line.
If you've made a mistake and would like to roll back all of the
changes from the last Replace in Files operation,
click the Undo Replacements button in the Find
Results tab toolbar.
Find Results tabs are opened in the Bottom Pane to display
matches from Find All, Find in
Files or Replace in Files operations.
Komodo can open two tabs, Find Results 1 and
Find Results 2, which can be locked using the
Lock button in their respective toolbars. New find or
replace operations will not overwrite contents in a locked tab.
Komodo uses the first available tab for output. If both tabs are
locked during subsequent find or replace operations, Komodo prompts
you to unlock one of the tabs or cancel the action.
The Find Results tabs display columns for:
- File: the path and filename in which the match or replacement occurred
- Line: the line number on which the match or replacement occurred
- Content: the text that was matched or replaced
Double-click on any output line to jump to the relevant file and
line in an editor tab.
The Find Results toolbar has buttons to:
- Jump to Previous/Next Result
- Stop Search
- Undo Replacements (with Replace in Files output)
- Lock or Unlock the tab
The Open/Find
toolbar provides a quick way to open files and find
strings. The toolbar is not displayed by default; to open
it select View|Toolbars|Open/Find.
This toolbar has three fields:
- Open: The file to open. Use the full path of
the file, the relative path from the directory of the current file,
or just the filename if it's in the same directory as the current
file.
- Find: The string to search for. Pressing
'Enter' after typing the search term searches the current file.
- in: The directory or file to search in.
Pressing 'Enter' in this field causes the search term in the
Find field to be applied to the specified directory
or file instead of the current file. You can use the
Browse button to the right of the field to populate
this field. Accepts the glob wildcards '*' and '?'.
The Find and in fields both
keep a list of the most recently entered strings and file
specifications.
If a file or directory is specified in the in
field, matches will be displayed in a Find Results tab.
Press 'Esc' to return focus to the Komodo editor. All fields can be
accessed via their associated key bindings.
The Function Search looks through the current document for the
following constructs:
- Perl programs:
sub and
package statements.
- Python programs:
class and
def statements.
- PHP programs:
class and
function statements.
- Ruby programs:
module,
class and def statements.
- Tcl programs:
proc
statements.
Use Code|Find Next Function or Code|Find
Previous Function (or the associated key bindings) to cycle
through the functions.
Use Code|Find All Functions to display a list of
all functions in a Find
Results tab. Double-click on any entry to jump to the
relevant line.
|