Feature Showcases
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:
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:
Invoke the search by clicking the desired search command button:
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:
The following replace options can be configured:
Specify where Komodo should replace the specified text. In the "Replace in" section, select one of the following:
Invoke the search by clicking the desired search command button:
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:
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.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.*.pl;*.tcl
. (Note that multiple
file extensions are separated by any combination of semicolons,
spaces, colons, and commas.)*.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.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 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. 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:
sub
and
package
statements.class
and
def
statements.class
and
function
statements.module
,
class
and def
statements.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.