Komodo provides a variety of methods for searching and replacing text, both
within files open in the editor and within files on the filesystem. While
Komodo has standard search and replace functionality, it also features
unique search mechanisms like searching for the work under the cursor,
incremental searching and function search.
|
|
The Find dialog box is used to search for words or phrases in the current
document. To open the Find dialog box, from the Edit menu,
select Find, or use the associated
key binding.
Enter the text you wish to find in the Find what field.
The following search options can be configured:
- Match Case: To find matches of the search string
regardless of case, select No. To find matches only when
the search string matches the case of the occurrence, select
Yes. To find exact case matches only when the search
string contains mixed case, select Yes, if search string contains
capital letters. For example, if you enter "mystring" in the
Find what field and select Yes, if search
string contains capital letters, both "mystring" and "myString"
will match. However, if you enter "myString" in the Find
what field, only "myString" will match.
- Use: Choose Plain Text to exactly
match the search string. Regular Expressions will interpret
the search string as a Python regular expression, and perform the search
accordingly; Wildcards will interpret asterisk and question
mark characters as wildcards. The option specified (Plain Text,
Regular Expressions (Python), Wildcards) becomes the default search type
used for the Open/Find Toolbar.
- Match whole word: If this box is checked, matches
in the document will only be found if whitespace occurs on either side
of the search string. For example, if the search string is "edit" and
"Match whole word" is selected, only occurrences of the word "edit" will
be found as matches. However, if "Match whole word" is not selected,
"editing", "editor", "editorial" and "edited" will also be found as
matches.
- Search up: This performs the search from the cursor
position to the top of the file, rather than from the cursor position to
the bottom of the file. (The default functionality is to search down
from the cursor position.)
- Display results in Find Results 2: Komodo supports
two Find Results tabs in the
Bottom Pane. Check this
box to display the search results in the second, rather than the first,
Find Results tab. If this box is not checked, the first
Find Results tab is used to display the results of the
search.
The Open/Find toolbar uses the
settings from the Find in Files and
Find dialog boxes as default search parameters.
For example, if you configure the Find dialog box to
search using wildcards, the Open/Find toolbar will also perform
wildcard searches.
Specify where Komodo should search for the text. In the "Search in" section,
select one of the following:
- Current document: This searches the document
that is currently in focus in the editor for occurrences of the search
string.
- Selection only: will only search the
highlighted area of the document that is in focus in the editor. (If you
search a selected section, the highlighting of the selected section will be
temporarily turned off in order to display highlighted results of the
Find function.)
- All open documents: Search for the string in all
documents currently open in the editor.
Invoke the search by clicking the desired search command button:
- 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.
- Mark All: Inserts a
bookmark on each line that
contains the search string. To move the editing cursor to a bookmarked line,
press F2.
To display the results of a previous search, click the relevant Find
Results tab in the Bottom Pane. If the Bottom Pane is not displayed,
select View|Tabs|Find Results.
The Replace dialog box is used to search for and replace words or phrases in
the current document. To open the Replace dialog box, from the
Edit menu, select Replace, or
use the associated
key binding.
Enter what to find and replace with:
- Find what: Enter the search string you want to
find.
- Replace with: Enter the replacement
characters.
The following replace options can be configured:
- Match Case: To find matches of the search string
regardless of case, select Never. To find matches only when
the search string matches the case of the occurrence, select
Always. To find exact case matches only when the search
string contains upper-case letters, select "If Search String Contains
Capital Letters". For example, if you enter "function" in the
Find what field and select "If Search String Contains
Capital Letters", both "function" and "Function" will match. However, if
you enter "Function" in the Find what field, only
"Function" will match.
- Use:
Plain Text will exactly match the
search string; Regular Expressions will interpret the
search string as a Python regular expression, and perform the search
accordingly; Wildcards will interpret asterisk and question
mark characters as wildcards.
- Match whole word: If this box is checked, matches
in the document will only be found if whitespace occurs on either side
of the search string. For example, if the search string is "edit" and
"Match whole word" is selected, only occurrences of the word "edit" will
be found as matches. However, if "Match whole word" is not selected,
"editing", "editor", "editorial" and "edited" will also be found as
matches.
- Search up: Performs the search from the cursor
position to the top of the file, rather than from the cursor position to
the bottom of the file.
- Show "Replace All" Results: Displays the number of
replacements in the status bar at the bottom left of the Komodo
Workspace. Details of each change, complete with the line number, will
appear on the Find
Results tab in the Bottom Pane.
- Display in Find Results 2: Komodo supports two
Find Results tabs in
the Bottom Pane. Check this box to display the search results in the
second, rather than the first, Find Results tab. If
this box is not checked, the first Find Results tab is
used to display the results of the search.
Specify where Komodo should replace the specified text. In the "Replace in"
section, select one of the following:
- Current document: Searches the document that is
currently in focus in the editor for occurrences of the search
string.
- Selection only: Only searches the highlighted area of
the document that is in focus in the editor. (If you search a selected
section, the highlighting of the selected section will be temporarily
turned off in order to display highlighted results of the Find
function.)
- All open documents: Searches for the string in all
documents currently open in the editor.
Invoke the search by clicking the desired search command button:
- Find Next: Finds consecutive occurrences of the
search string in your file or selection. As matches are found, the text
is highlighted. Click Replace to replace the
highlighted text with the replacement string.
- 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.
When the editing cursor is within (or adjacent to) a word, you can quickly
search for other occurrences of the same word within the current document.
If you are using the default
key binding scheme,
press 'Ctrl'+'F3' to select the word; continue pressing 'Ctrl'+'F3' to
step through each occurrence in the document. ('Meta'+'F3' for Mac OS X users.)
Incremental search is used to look through the current file in the Editor
Pane for a group of incrementing characters. That is, as you continue to type in
search characters, Komodo will find the next occurrence of the search string.
After all the search characters have been entered, you can move through each
occurrence of the search string within the current file.
To start an incremental search select
Edit|Incremental Search, or use the associated
key binding. (If
you are using the default key binding scheme, the key binding is 'Ctrl'+'I' on
Windows and Linux and 'Meta'+'I' on Mac OS X.)
The status bar (in the bottom left corner of the Komodo
workspace) will display the text "Incremental Search:". Begin typing the
characters you want to find; as you type characters, the editing cursor will
move to the first match beneath the current cursor position within the current
file, and the search string will be displayed in the status bar.
To change the search string based on the characters
surrounding the editing cursor, use the associated
key binding. If
the default key binding
scheme is in effect, the key combination is
'Shift'+'Right Arrow' (to add one or more characters to the right of the editing
cursor) or 'Shift'+'Left Arrow' (to remove one or more characters
to the left of the editing cursor). On Mac OS X the key bindings are 'Meta'+'Right Arrow'
and 'Meta'+'Left Arrow'.
For example, if you entered "fo" as the search string, and the next
occurrence of these characters was in the word "foo", you could use the
'Shift'+'Right Arrow' key combination to extend the search string
to "foo". Conversely, you could use the 'Shift'+'Left Arrow' key
combination to reduce the search string to "f".
To search through the file for the search string press
'Ctrl'+'I' to find subsequent occurrences of the search string
within the current file (On Mac OS X, press 'Meta'+'I'). Continue pressing
'Ctrl'+'I' to cycle through all occurrences. When the search reaches the bottom
of the file, it will continue from the top of the file. 'Ctrl'+'Shift'+'I' will
search backwards from the current cursor positon (On Mac OS X, press
'Meta'+'Shift'+'I').
To cancel the incremental search press any key except the
key bindings assigned to the incremental search functions.
The Find in Files dialog box complements the
Find dialog box by providing the ability to
search for text in files that are not currently opened in Komodo. Select
Edit|Find in Files (or use the associated
key binding)
to open the new dialog box.
The Find in Files dialog box consists of the following options:
- Find what: Enter the search string.
- Match Case: To find matches of the search string
regardless of case, select No. To find matches only when
the search string matches the case of the occurrence, select
Yes. To find exact case matches only when the search
string contains mixed case, select Yes, if search string contains
capital letters. For example, if you enter "mystring" in the
Find what field and select Yes, if search
string contains capital letters, both "mystring" and "myString"
will match. However, if you enter "myString" in the Find
what field, only "myString" will match.
- Match whole word: If this box is checked, matches in the
document will only be found if whitespace occurs on either side of the search
string. For example, if the search string is "edit" and "Match whole word" is
selected, only occurrences of the word "edit" will be found as matches.
However, if "Match whole word" is not selected, "editing", "editor",
"editorial" and "edited" will also be found as matches.
- Use: Choose
Plain Text to exactly match
the search string. Regular Expressions will interpret the search
string as a Python regular expression and perform the search accordingly;
Wildcards interpret asterisk and question mark characters
as wildcards.
- Search in: By default, the
Search in field is populated with a period, which
indicates that the "current" directory will be searched. (If no file is
open, the current directory is the value specified in the
HOME environment variable; if the HOME variable
is not defined, the current directory is "C:\" on Windows and "/" on
OS X and Linux. If one or more files are open, the location of the file
that is displayed in the Editor Pane is the current directory.) To search
directories other than the current, either specify an absolute
path, or specify a relative path from the current directory. For example,
if the current directory is /home/fred/tmp/foo, you could search
the /home/fred/tmp/bar directory by entering ../bar.
Manually enter one or more directories; multiple directories are
separated by semicolons. Alternatively, click the browse button to the
right of the field to display a directory browser dialog box. (Directories
already specified in the Search in field will be
displayed in this dialog box.) Use the directory browser to navigate the
filesystem, specify one or more search directories, and/or alter the
order in which the directories are searched.
- Search in subfolders: If this box is checked,
subdirectories beneath the directories specified in the Search
in field are also searched.
- Include: To specify one or more file types that should be
searched, enter the file extensions preceded by a wildcard. For example, to
search files with ".pl" and ".tcl" extensions, enter
*.pl;*.tcl .
(Note that multiple file extensions are separated by any combination
of semicolons, spaces, colons, and commas.)
- Exclude: To specify one or more file types that should be
excluded from the search, enter the file extensions preceded by a wildcard.
For example, to exclude files with ".exe" and ".doc" extensions, enter
*.exe;*.doc . (Note that multiple file extensions are
separated by any combination of semicolons, spaces, colons, and
commas.) If both the Include and
Exclude fields are blank, all file types are
searched.
- Display results in Find Results 2: Komodo supports two
Find Results
tabs in the Bottom Pane. Select this check box to display the search
results in the second, rather than the first, Find
Results tab. If this box is not checked, the first Find
Results tab is used to display the results of the search.
After clicking Find All, the Find Results 1
or Find Results 2 tab (depending on the setting of the
Display results in Find Results 2 check box) are displayed in
Bottom Pane. Depending on the number of files that are being searched, it may
take some time to generate results. (The search status is displayed on the top
line of the Find Results tab. The results include the file in
which the search string is found, the line number in the file where the search
string occurs, and the context surrounding the search string. Double-click a
search result (or click the arrow button at the top right of the pane) to open
the file in the editor and place the editing cursor on the selected
occurrence.
The Open/Find toolbar
provides quick access for opening
files and finding strings. Find strings in files currently displayed in the
editor or in files not currently open in Komodo but located on the filesystem.
The toolbar is displayed by default; to close or open the toolbar, select
View|Toolbars|Open/Find.
The Open/Find toolbar also provides fast access to find
functionality. The Find and in fields are used
to perform searches on files in Komodo or elsewhere in the filesystem. Both
fields have a list of the most recently entered strings and file specifications.
Use the in field browse button, located to the right of the
in field, to populate this field with the directory, folders,
or files you want to search.
Enter the string that you wish to search in the Find
field. The Find toolbar uses the settings from
the Find in Files and
Find dialog boxes as default search parameters.
For example, if you configure the Find dialog box to
search using wildcards, the Find toolbar will also perform
wildcard searches.
Specify the files that should be searched in the in field.
The in field uses the same logic as the Open
field to determine the current directory. (If no file is open, the current
directory is the value specified in the HOME environment variable;
if the HOME variable is not defined, the current directory is "C:\"
on Windows and "/" on OS X, Linux and Solaris. If one or more files are open, the
location of the file that is displayed in the Editor Pane is the current
directory.)
To search directories other than the current, either specify an absolute
path, or specify a relative path from the current directory. For example,
if the current directory is /home/fred/tmp/foo, you could search the
/home/fred/tmp/bar directory by entering ../bar.
Alternatively, use the in field browse button to locate and
populate this field with the directory, folders, or files you want to
search.
The in field accepts wildcards; use "*" for a file name
segment and "?" for a specific character. Separate multiple directories with
semicolons. If nothing is specified in the in field, the search
will be performed against the file that is currently displayed in the Editor
Pane (if applicable), and the next occurrence of the search string is
highlighted.
For example, to search for occurrences of the string "error" in all files
located in the directory /tmp/output, enter error in
the Find field and /tmp/output/* in the
in field.
If files are specified in the in field, matches will be
displayed in the Find Results
tab.
At any time, press the Escape key to return focus to the
Komodo editor. The Find field can be accessed via the
associated key
binding.
For example, to search for occurrences of the string "debug" in all files
located in the directory /tmp/log on a machine running Linux, enter
debug in the Find field. Enter
/tmp/log/* in the in field, or use the
"browse" button to locate this directory on your filesystem. For more
information on searching using the Open/Find Toolbar, see Finding
Strings.
The Find Results 1 tab (located in the
Bottom Pane)
displays all matches that result when the Find All
function in the Find dialog box is used. The Find Results 1 tab displays the
line number on which the match occurred and the line that contains the match.
Double-click a line in the Find Results tab to display the line in the Editor
Pane.
The Find All function in the Find and Replace dialog box, and the Find in Files dialog box (Edit|Find in
Files) both make use of the Find Results tab, which
displays the result of the search on the Command Output tab. Komodo includes a
second output tab that can be specified by checking the Display results
in Find Results 2 check box. By using both tabs, search results are not
overwritten every time a new search is invoked.
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.
To search forward from the current cursor position, select Code|Find
Next Function, or use the associated
key binding.
To search backwards from the current cursor position, select
Code|Find Previous Function, or use the associated
key binding.
To find all instances of functions within the current document, select
Code|Find All Functions, or use the associated
key binding. The
list of functions in the current document will be displayed on the Find
Results tab located in the
Bottom Pane of the Komodo
Workspace. Double-click a specific construct on the Find
Results tab to highlight the relevant line in the
Editor Pane.
|