Komodo User Guide

Editing Files

Komodo's editor provides support for programming in multiple languages, especially Perl, Python, Tcl, XSLT and PHP. Features of the Komodo editor are described below.

Top

Editor Features

Syntax Coloring and Indentation

The Komodo editor is language-sensitive. When you open a file in a supported language, Komodo will color the syntax,format indentation, and provide indentation guides. Komodo supports syntax coloring and indentation for the following languages:

  • Ada
  • Batch
  • C#
  • C++
  • Diff
  • Eiffel
  • HTML
  • IDL
  • Java
  • JavaScript
  • LaTeX
  • Lisp
  • Lua
  • Makefile
  • Pascal
  • PHP
  • Perl
  • Python
  • Ruby
  • SQL
  • Tcl
  • VisualBasic
  • XML
  • XSLT

More Information:

Top

Code Folding

Code folding is used to collapse and expand blocks of code. Code folding is especially useful for viewing a structural overview of your file; for example, you can collapse individual subroutines in the program to view the program's general structure. Komodo supports code folding for the following languages:

  • C#
  • C++
  • Java
  • JavaScript
  • Lisp
  • Pascal
  • PHP
  • Perl
  • Python
  • Ruby
  • Tcl
  • XML
  • XSLT

More Information:

Top

Commenting and Uncommenting Blocks of Code

The commenting function is used to convert a single line or a group of lines into a comment, with the syntax appropriate for the file's language. Komodo supports commenting for the following languages:

  • JavaScript
  • PHP
  • Perl
  • Python
  • Tcl
  • XML

More Information:

Top

Background Syntax Checking

As you write code in the editor, Komodo periodically checks for syntax errors. Syntax errors are underlined with a red wavy line; syntax warnings are underlined with a green wavy line. Note that Komodo uses the language interpreter's own error-checking functions. There, there may be slight differences in the way that syntax errors are detected and displayed depending on the version of the interpreter.

At the bottom of the Komodo workspace, the syntax checking icon displays the syntax status of the current file displayed in the editor pane:

A blue check-mark over the syntax checking icon () indicates that the language interpreter does not detect any warnings or errors in the program.

A red x over the syntax checking icon () indicates that the interpreter detects one or more errors. To see the number of errors and warnings contained in the program, hover your mouse pointer over the syntax checking icon. A pop-up tool tip will display the total number of errors and warnings. If the syntax analysis is not yet complete, the tool tip will say "in progress".

To move the editing cursor to the line containing the error or warning, double-click the syntax checking icon. If there are multiple errors or warnings, each time you double-click the icon, the editing cursor will move to the next error.

You can view the error message from the interpreter by using one of the following methods:

  • Hover the mouse pointer over the error. The interpreter error will be displayed in a pop-up tool tip.
  • If the editing cursor is on the same line as the error, the interpreter error will be displayed on the status bar in the bottom left corner of the Komodo workspace.

Komodo supports background syntax checking for the following languages:

  • HTML
  • JavaScript
  • Perl *
  • PHP**
  • Python
  • XML
  • XSLT
* requires ActivePerl build 623 or higher

** requires PHP version 4.05 or greater

More Information:

Top

Customizing Editor Preferences

Editor functions related to whitespace (tabs, smart tabs, indentation) and smart editing (background syntax checking, AutoComplete, CallTips) can be customized to suit your preferences. Preferences can be configured to apply to all files, or to apply only to the file that is currently active in the editor.

More Information:

Top

AutoComplete

AutoComplete presents a pop-up list of choices when it encounters functions, methods and properties for which there is a pre-defined set of options. AutoComplete functionality varies according to the language; for example, Python AutoComplete lists methods and properties, while XML AutoComplete lists element and attribute names and values. As you type additional characters, the items in the pop-up list will be reduced to those that match the characters you have entered.

Use the arrow keys to scroll the list; use the Tab key to inset an item from the pop-up list into your document; use the Esc key to close the pop-up list.

AutoComplete functionality is described below for each supported language:

More Information:


PHP AutoComplete

AutoComplete for PHP is available for the following language elements:

  • Classes and Methods Classes in the current file (including Web services), and classes in any included files, are displayed upon entry of the keyword "new". Methods in the class are displayed when you enter "->".
  • Functions Standard PHP functions, and functions defined within the script (and within any included files) are displayed when you enter "->".
  • Variables Variables declared in the current file, or in any included files, are displayed when you enter the symbol "$" followed by a letter. For variables declared within the current file, only those variables declared above the current line will be included in the pop-up list.

To use an item from the AutoComplete pop-up list, scroll the list to select the item, then press Tab to insert.

Python Autocomplete

AutoComplete for Python lists the methods and properties available for modules and objects used by Komodo. Komodo is a Python application, and it opens numerous Python modules. If a module is in use by Komodo, attributes for the module will be listed in the autocomplete pop-up list. Otherwise, the autocomplete options are limited to attributes already used in the current file.

To use AutoComplete in Python files:

  1. Import the "os" module into your current Python file.
  2. Enter the "os" followed by a period (".") (without the quotes). A popup window lists methods and properties available for the os module.
  3. Move up and down through the list using the arrow keys.
  4. Press Tab to select the desired method name.

Perl AutoComplete

AutoComplete for Perl lists methods contained in Web service objects. See Perl and Web Services for more information.

AutoComplete for Perl will also list methods for modules and variables that have been used elsewhere in the same program.

Tcl AutoComplete

AutoComplete for Tcl lists all valid methods for a command.

To use AutoComplete in Tcl files:

  1. Begin typing "string is alpha". After you enter "str", a popup window lists methods that begin with str.
  2. Move up and down through the list using the arrow keys.
  3. Press Tab to select the desired method name.
  4. If you keep typing, when you get to "is", the popup window lists a reduced list of valid methods.
  5. Move up and down through the list using the arrow keys.
  6. Press Tab to select the desired method name.

XML AutoComplete

AutoComplete for XML lists all valid elements for the file, attributes for each element, and suggested attribute values.

To use AutoComplete in XML files:

  1. Enter "<".
    A popup window lists valid elements in the file.
  2. Move up and down through the list using the arrow keys.
  3. Press Tab to select the desired element name.
  4. Press Space to insert a space after the element.
    A popup window lists valid attributes for that element, if attributes exist for that element.
  5. Move up and down through the list using the arrow keys.
  6. Press Tab to select the desired attribute name.
  7. Enter "="".
    A popup window lists suggested attribute values, if suggestions for that attribute are available.
  8. Move up and down through the list using the arrow keys.
  9. Press Tab to select the desired value.
  10. To end the tag, enter "">"

Autocomplete also helps with closing XML tags:

  • Enter "</".
    A popup window lists the most recently opened tag. Note that the option includes the closing angle bracket ">".

XSLT AutoComplete

AutoComplete for XSLT lists all valid elements for the xsl namespace, attributes for the element, and suggested attribute values.

To use AutoComplete in XSLT files:

  1. Enter "<xsl:".
    A popup window lists valid elements in the xsl namespace.
  2. Move up and down through the list using the arrow keys.
  3. Press Tab to select the desired element name.
  4. Press Space to insert a space after the element.
    A popup window lists valid attributes for that element, if attributes exist for that element.
  5. Move up and down through the list using the arrow keys.
  6. Press Tab to select the desired attribute name.
  7. Enter "="".
    A popup window lists suggested attribute values, if suggestions for that attribute are available.
  8. Move up and down through the list using the arrow keys.
  9. Press Tab to select the desired value.
Top

CallTips

CallTips present you with a reference list of the parameters or arguments for a given function or method. To use CallTips:

  1. Enter a function or method name followed by an open parenthesis "(".
  2. Use the pop-up as a reference for the parameters and arguments suitable for the function or method.
  3. Close the parenthesis.

To clear the calltip, press the Esc key.

CallTips are available for the following languages:

More Information:

Top

Most Recently Used List

Komodo's File menu shows you your most recently used files and projects in the File menu. Modify Komodo's Appearance preferences to configure the number of projects and files displayed in the list, or to clear the current contents of the list.

To open one of your most recently used files:

  1. From the Files menu, select Recent Files.
  2. Select the file name.

To open one of your most recently used projects:

  1. From the Files menu, select Recent Projects.
  2. Select the project name.
Top

Detect Changed Files

Komodo can be configured to monitor the status of files that are opened in the editor. If the file is changed on disk, you will be prompted to re-load the latest version under the following circumstances:

  • when you change between tabs in the editor
  • when you switch back to Komodo from another application
  • when you save a file

Use Komodo's Preferences to enable or disable this function.

Top

HTML Preview

When you open a file that Komodo identifies as an HTML file (according to the File Associations configured in Komodo's Preferences), Komodo will display two tabs beneath the editing pane. The first is labeled "Source", and will display the source for the HTML file. The second is labeled "View", and will display a rendered version of the HTML file, including styling from any associated style sheet.

Note that the right-click context menu in the editor pane is only available when the "Source" tab is in focus.

Top

Performing Common Editing Tasks

Finding Words or Expressions

The Find dialog is used to search for words or phrases in the current document. To open the Find dialog, press Ctrl+F, or, from the Edit menu, select Find.

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 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 "elephant" in the Find what field and select "If Search String Contains Capital Letters", both "elephant" and "Elephant" will match. However, if you enter "Elephant" in the Find what field, only "Elephant" 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" would also be found as matches.
  • Ignore hidden text: if this box is checked, only text displayed in the editor will be searched. Any text that is hidden because of a folded code block will not be searched.
  • Search up: will perform 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.)

Specify where Komodo should search for the text. In the "Search in" section, select one of the following:

  • Current document: will search 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: will search for the string in all documents currently open in the editor.

Invoke the search by clicking the desired search command button:

  • Find Next: will find consecutive occurrences of the search string in your file or selection. As matches are found, the text will be highlighted. The Find dialog remains in focus. To keep the focus in your file, close the Find dialog, then press F3 to Find Next, or Shift+F3 to Find Previous.
  • Find All: will locate all occurrences of the search string in your file or selection. The matches will be displayed in the Find Results tab of the Output Pane.
  • Mark All: will insert a bookmark on each line that contains the search string. To move the editing cursor to a bookmarked line, hit F2.

The Find Results Tab

The Find Results tab (at the bottom of the Komodo screen) displays all matches that result when the Find All function in the Find dialog is used. The Find Results tab displays the line number on which the match occurred and the entire line which contains the match. Double click on a line in the Find Results tab to display the line in the editor pane.

Searching for the Word Under the Cursor

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. Press Ctrl+F3 to select the word; continue pressing Ctrl+F3 to step through each occurrence in the document.

Top

Incremental Search

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 keyboard shortcut Ctrl+I. 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 key combination 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).

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. 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.

To cancel the incremental search press any key except the keyboard shortcuts described above.

Top

Function Search

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.
  • Tcl programs: proc statements.

To search forward from the current cursor position, select Edit | Source Code | Find Next Function, or press F8. To search backwards from the current cursor position, select Edit | Source Code | Find Previous Function, or press Shift + F8. To find all instances of functions within the current document, select Edit | Source Code | Find All Functions, or press Ctrl + F8. The list of functions in the current document will be displayed on the Find Results tab at the bottom of the Komodo workspace.

Top

Replacing Words or Expressions

The Replace dialog is used to search for and replace words or phrases in the current document. To open the Replace dialog, press Ctrl+H, or, from the Edit menu, select Replace. The following options are available:

  • Find what: enter the search string you want to find.
  • Replace with: enter the replacement characters.
  • 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" would also be found as matches.
  • Ignore hidden text: if this box is checked, only text displayed in the editor will be searched. Any text that is hidden because of a folded code block will not be searched.
  • Search up: will perform the search from the cursor position to the top of the file, rather than from the cursor position to the bottom of the file.
  • Replace in: "Current document" will search the current document for occurrence of the search string; "Selection only" will search the highlighted area of the document only. (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" will search for the string in all documents open in the editor.
  • Find Next: will find consecutive occurrences of the search string in your file or selection. As matches are found, the text will be highlighted. Click Replace to replace the highlighted text with the replacement string.
  • Replace: will highlight 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: will replace all occurrences of the search string in the document or selection without prompting for confirmation. All replacements will be displayed in the Replace Results tab of the Output Pane.

The Replace Results Tab

The Replace Results tab (at the bottom of the Komodo screen) displays all replacements that result when the Replace All function in the Replace dialog is used. The Replace Results tab displays the line number on which the match occurred and the entire line which contains the match. Double click on a line in the Replace Results tab to display the line in the editor pane.

Top

Indenting and Un-indenting Lines of Code

To indent a single line or a selected block of code:

  • Single Line: position the cursor at the start of the text on the desired line. Press <Tab>, or, from the Edit menu, select Source Code | Increase Line Indent
  • Multiple Lines: select the desired lines by clicking and dragging in the editor pane. Press <Tab>, or, from the Edit menu, select Source Code | Increase Line Indent

To un-indent single line or a selected block of code:

  • Single Line: position the cursor at the start of the text on the desired line. Press <Shift> + <Tab>, or, from the Edit menu, select Source Code | Decrease Line Indent
  • Multiple Lines: select the desired lines by clicking and dragging in the editor pane. Press <Shift> + <Tab>, or, from the Edit menu, select Source Code | Decrease Line Indent

Specify the number of spaces per tab in the Indentation Editor Preferences (Edit | Preferences | Editor | Indentation).

Top

Converting between Uppercase and Lowercase

To convert a selection of text from uppercase to lowercase (or vice-versa), do the following:

  • From the Edit menu, select Source Code, then Make Uppercase or Make Lowercase
    or
  • Press Ctrl+U (for uppercase text) or Ctrl+Shift-U (for lowercase text)
Top

Transposing Characters

To reverse the position of the two characters to the left of the editing cursor, use the Ctrl+T keyboard shortcut.

Top

Literal Characters

Use the Ctrl+M prefix to insert literal characters into the editor. For example, to insert a form feed, enter Ctrl+M, Ctrl+L. The following functions are common:

  • Ctrl+L: Form Feed (shown as "FF")
  • Esc: Escape character (shown as "ESC")
  • Return or Ctrl+M: Carriage Return (shown as "CR")
  • Ctrl+J: Line Feed (shown as "LF")
  • Tab or Ctrl+I: Tab (shown as "---->")
Top

Commenting and Un-commenting Lines or Blocks of Code

To comment a single line of code, ensure your cursor is on the desired line, then:

  • From the Edit menu, select Source Code, then Comment Region
    or
  • Press Ctrl+3

To un-comment a line of code, ensure your cursor is on the desired line, then:

  • From the Edit menu, select Source Code, then Uncomment Region
    or
  • Press Ctrl+Shift+3

To comment a block of code, select the lines you wish to comment by clicking and dragging the mouse in the editor pane, then:

  • From the Edit menu, select Source Code, then Comment Region
    or
  • Press Ctrl+3

To un-comment a line of code, ensure your cursor is on the desired line, then:

  • From the Edit menu, select Source Code, then Uncomment Region
    or
  • Press Ctrl+Shift+3
Top

Tabifying and Un-tabifying Regions

"Tabifying" a region converts leading spaces to tabs. If you select a line of code that has some leading spaces and you choose to tabify the region, you convert all the leading spaces into Tab characters. The Tabify region dialog allows you to set the ratio of space characters to Tab characters. If you select 8, then each 8 space characters will be represented as 1 Tab character.

Tabifying a Region

To tabify a region:

  1. In the Edit menu, select Source Code, then Tabify Region.
  2. In the dialog, set the number of spaces, from 1 to 16, to apply to a tab.
    Click OK or press Enter.

Un-tabifying a Region

To un-tabify a region:

  1. In the Edit menu, select Source Code, then Un-tabify Region.
  2. In the dialog, set the number of spaces, from 1 to 16, to apply to a tab.
  3. Click OK or press Enter.
Top

Example of Tabifying a Region

To illustrate tabifying, follow this procedure:

  1. Open the sample_project.kpf.
  2. Open perl_sample.pl.
  3. Turn on the Line Numbers.
  4. Turn on the Whitespace characters.
  5. Find the following line: $sum += $prices[$i]; There are four leading spaces on this line. We can tabify this line and convert each space character into one Tab character.
  6. Tabify this line. Set the number of spaces to 1. This means each space character will be converted to one Tab character.
  7. Now this line has four Tab characters, represented as right arrows, preceding print $sum += $prices[$i];. This causes the line to be indented too far.
  8. Un-tabify this line. Set the number of spaces to 1. This returns the line to the original state.

Let's look at another line with 8 leading spaces.

  1. Open python_sample.py
  2. Find the following line:  print "element %s is a string" % element. There are 8 leading spaces on this line.
  3. Tabify this line. Set the number of spaces to 8. This means the 8 spaces will be converted to one Tab character. 
  4. Now this line has one Tab character, represented as a right arrow, preceding print "element %s is a string" % element;. This does not change the line's indentation.
  5. Un-tabify this line. Set the number of spaces to 8. This returns the line to the original state.

You can set the width of Tab characters in the Preferences dialog. The default value is 8.

Top

Completing Words

The Komodo editor maintains an index of words in the current file. Therefore, rather than re-entering words that already exist in the current file, you can use the Complete Word function to finish words.

Enter one or more characters, then select Edit | Source Code | Complete Word, or press Ctrl + Space. Continue pressing the spacebar to cycle through all possible completions for the word.

Top

Moving to a Specific Line

While editing, you can move to a specific line number as follows:

  1. In the View menu, select Goto Line.
  2. In the dialog, enter the line number.
  3. Click Goto Line or press Enter.
Top

Setting and Moving to Bookmarks

Bookmarks are points of interest in a file. Komodo displays blue triangles on the left margin beside bookmarked lines.

  • To set or unset a bookmark: Place the editing cursor on the line of interest. Select View | Bookmarks | Toggle Bookmark or press Ctrl+F2 to bookmark the line. If the line is already bookmarked, the bookmark will be removed.
  • To move to the next bookmark: Select View | Bookmarks | Next Bookmark or press F2.
  • To move to the previous bookmark: Select View | Bookmarks | Previous Bookmark or press Shift+F2.
  • To clear all bookmarks Select View | Bookmarks | Remove All Bookmarks or press Ctrl+Shift+F2.
Top

Viewing the Current File as Another Language

Komodo's syntax coloring, background syntax checking, and indentation are language-specific. However, Komodo provides the option to view a file as another language. This is useful when you open, for example, a Perl file that has no extension. You can select View as Perl and then edit the file as a regular Perl file. Komodo's File Associations do not allow you to set a language association with a file that doesn't have an extension.

To view the current file as another language:

  1. From the View menu, select View as Language.
  2. From the list, select the language you want.

If you have opened a file that does not have a file association specified in the Preferences dialog, Komodo displays the file as text. You can select to view the file as another language, but Komodo does not remember again. If you will be working with a new type of file, we recommend you specify a file association.

For example, if you open a DocBook (*.docb) file in Komodo, it does not have XML syntax coloring. Specify a file association to tell Komodo to open *.docb files as XML files. For more information on specifying file associations, see Customizing File Associations.

Top

Toggling Whitespace On and Off

Whitespace is any space in a file not taken up by text. Line breaks, spaces, and tabs are considered whitespace.

To toggle whitespace on and off, do one of the following:

  • In the View menu, select View Whitespace
    or
  • Press Ctrl+Shift+8

You can also set a default for whitespace display. For more information, see Customizing Editor Features.

Top

Toggling Indentation Guides On and Off

Indentation guides display vertical lines in the editor pane that indicate the number of whitespace indents. The width of indentation guides is determined by the value in the Indentation Width preference. See Customizing Indentation for more information.

To toggle indentation guides on and off:

  • In the View menu, select View Indentation Guides
Top

Toggling Line Numbers On and Off

Line numbers can help orient you when working in a long file.

To toggle line numbers on and off:

  • In the View menu, select View Line Numbers

You can also set this option globally. For more information, see Customizing General Editor Features.

Top

Toggling EOL (end of line) Markers On and Off

End-of-line markers indicate where and how a line ends, such as by a hard return or another key. If you use Enter to end a line, the EOL marker could be CR or CR+LF.

To toggle EOL markers on and off:

  • In the View menu, select View EOL markers

You can also set this to be on globally. For more information, see Customizing General Editor Features.

Top

Increasing and Decreasing the Code Font Size

To increase the font size in the Editor Pane:

  1. From the View menu, select Font, then Increase.
    Or press Ctrl+].
    This new size applies to all files open in the Editor pane.
  2. Repeat until the font size is appropriate.

To decrease the font size:

  1. From the View menu, select Font, then Decrease.
    Or press Ctrl+[
    This new size applies to all files open in the Editor pane.
  2. Repeat until the font size is appropriate.

When you save a file, the new font size is saved.

Top

Toggling Fixed and Non-Fixed Width Font

Komodo allows you to use either fixed width or non-fixed width fonts for your editing, and allows you to toggle between these settings. Komodo's default font is non-fixed width.

To toggle between fixed and non-fixed width font:

  1. From the View menu, select Font, then Fixed Width Font.
    Or press Ctrl+Shift+F.
    This changes your font to become fixed width.
  2. Repeat to reverse.
Top

Folding and Unfolding Code

Code folding symbols appear in the left margin of the Editor pane immediately left of the line of code that is or can be folded. Minus signs indicate the beginning of a block of code that can be collapsed or folded. Plus signs indicate the beginning of a block of code that can be expanded or unfolded. This line of code is also underlined.

You can fold one or all blocks of code.

Folding a Block of Code

To collapse or fold a single block of code, do one of the following:

  • Click the minus sign immediately left of a block of code
    or
  • Go to the View menu, select Fold, then Collapse
    or
  • Press Ctrl+Numpad Minus key

    The code below this line collapses, the next section of code moves up, and the minus sign becomes a plus sign.

Folding all Foldable Blocks of Code

To collapse or fold all foldable blocks of code, do one of the following:

  • Go to the View menu, select Fold, then Collapse All

    All foldable blocks of code collapse and the minus signs all become plus signs.

You can also unfold one or all blocks of code.

Unfolding a Block of Code

To expand or unfold a single block of code, do one of the following:

  • Click the plus sign immediately left of a block of code
    or
  • Go to the View menu, select Fold, then Expand
    or
  • Press Ctrl+Numpad Plus key

    The code below this line appears, the next section of code moves down, and the plus sign becomes a minus sign.

Unfolding All Foldable Blocks of Code

To expand or unfold all foldable blocks of code, do one of the following:

  • Go to the View menu, select Fold, then Expand All

    All foldable blocks of code expand and the plus signs all become minus signs.
Top

Matching Braces

Use the Matching Brace functions to quickly jump between opening and closing braces and parentheses. Notice that when the editing cursor is adjacent to a brace or parenthesis, the brace is displayed in bold red. The associated closing or opening brace is also displayed in bold red.

To jump to the matching brace, select Edit | Source Code | Jump to Matching Brace, or press Ctrl + ]. To select the braces and the contents they contain, select Edit | Source Code | Select to Matching Brace.

Top

Selecting Blocks of Code

You can quickly select blocks of code using Komodo's Select Block function (Edit | Source Code | Select Block, or Ctrl+B). This function uses the Code Folding logic; please refer to the list of languages for which Code Folding is supported.

When you invoke the Select Block function, Komodo will analyze the cursor position relevant to the blocks of code in the document. If the cursor is within a block, the entire block will be selected. (If the cursor is within a nested block, only the current sub-block will be selected, not the block that contains the entire nested structure.) If the cursor is not inside a block, the entire document will be selected.

Top

Editor Context Menu

Right-click in the editor pane for quick access to common editor functions. Use the left mouse button to select items from the context menu. In addition to standard cut, copy, paste and select all functions, you can also:

Top

Submitting a Recipe to the ASPN Cookbook

ASPN, the ActiveState Programmer Network, hosts code repositories for Python, Regular Expressions, XSLT and Tcl. We invite you to use code from the cookbooks, and we welcome contributions. To submit a recipe to an ASPN cookbook:

  1. In the Editor pane, select the code you wish to submit.
  2. Right-click the mouse button, and select Share Recipe, or select Tools|Cookbooks|Share Recipe.
  3. You will be prompted for your ASPN login (email address) and password. If you cannot recall your password, or require an ASPN account, click Get Account (ASPN Open accounts are free). To save your login information, click Remember these values. To subsequently remove your ASPN login information from Komodo, see ASPN Preferences.
  4. You will be prompted to enter the following information about your recipe:
    • Recipe Title becomes the text title for the recipe when it is displayed in the ASPN cookbook
    • Recipe Description a brief description of the recipe's function
    • Recipe Discussion describes why a user would want to do this task, why you chose this particular solution, known issues with your recipe, suggest alternative implementations, and list any helpful references
    • Choose a Cookbook select the appropriate cookbook for the recipe
    • Choose a Category select the appropriate category for the recipe
Top