Editing FilesKomodo's editor provides support for programming in multiple languages, especially Perl, Python, Tcl, XSLT and PHP. Features of the Komodo editor are described below. ![]() Editor FeaturesSyntax 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:
More Information:
![]() 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:
More Information: ![]() Commenting and Uncommenting Blocks of CodeThe 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:
More Information: ![]() 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 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 ( A red x over the syntax checking icon ( 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:
Komodo supports background syntax checking for the following languages:
More Information: ![]() Customizing Editor PreferencesEditor 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: ![]() 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 insert 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:
![]() CallTips
CallTips present you with a reference list of the parameters or arguments for a given function or method. To use CallTips:
To clear the CallTip, press the Esc key. CallTips are available for the following languages:
More Information: ![]() Most Recently Used ListKomodo's File menu contains submenus that display the most recently used files and projects. Recent files and projects are also displayed on Komodo's Start Page. Modify Komodo's Appearance preferences to configure the number of projects and files displayed in a list, or to clear the current contents of a list. To open one of your most recently used files from the File menu:
To open one of your most recently used projects:
Alternatively, you can open recent files and projects by clicking the file or project name on the Komodo Start Page. ![]() Detect Changed FilesKomodo 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 reload the latest version under the following circumstances:
Use Komodo's Preferences to enable or disable this function. ![]() Preview in BrowserYou can configure Komodo to preview a variety of file types in your default browser, or in the Editor Pane. The Preview in Browser feature is particularly useful when working with HTML or XML files. The browser preview will be displayed in a separate window, in the Editor Pane, or in a split view of the Editor Pane, depending on which preference has been set. The context menu in the Editor Pane is only available when the "source" tab is in focus. If Komodo does not support previewing of a specific file type, the Preview in Browser option will not be available from either the toolbar or the View menu. To preview a file with the Preview in Browser feature:
Use the following Window menu commands to manage the way previews and tab groups are displayed in the Editor Pane:
If displayed in the Editor Pane, previews include a toolbar with basic Web browser functionality, including (from left to right) "Back", "Forward" "Reload", and "Stop" buttons. ![]() Performing Common Editing TasksFinding Words or ExpressionsThe 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:
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:
The Find Results TabThe 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 line that 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 CursorWhen 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. ![]() Incremental SearchIncremental 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. ![]() Function SearchThe Function Search looks through the current document for the following constructs:
Moving From One Function to AnotherTo 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. Displaying a List of FunctionsTo 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. You can browse the results and double-click a specific construct on the Find Results tab to highlight the relevant line in the Editor Pane.![]() Replacing Words or ExpressionsThe 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:
The Replace Results TabThe Replace Results tab (at the bottom of the Komodo screen) displays all replacements that result when the Show "Replace All" Results option in the Replace dialog is selected. The Replace Results tab displays the line number on which the match occurred and the line that contains the match. Double-click on a line in the Replace Results tab to display the line in the Editor Pane. ![]() Indenting and Un-indenting Lines of CodeTo indent a single line or a selected block of code:
To un-indent a single line or a selected block of code:
Specify the number of spaces per tab in the Indentation Editor Preferences (Edit|Preferences|Editor|Indentation). ![]() Converting between Uppercase and LowercaseTo convert a selection of text from uppercase to lowercase (or vice-versa), do the following:
![]() Transposing CharactersTo reverse the position of the two characters to the left of the editing cursor, use the Ctrl+T keyboard shortcut. ![]() Literal CharactersUse 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:
![]() Commenting and Un-commenting Lines or Blocks of CodeTo comment a single line of code, ensure your cursor is on the desired line, then:
To un-comment a line of code, ensure your cursor is on the desired line, then:
To comment a block of code, select the lines you wish to comment by clicking and dragging the mouse in the Editor Pane, then:
To un-comment a line of code, ensure your cursor is on the desired line, then:
![]() 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.
![]() Selecting ColumnsSelect columns of text in Komodo by pressing the Alt key and then dragging with the mouse. This feature is particularly useful when you want to easily move code and data that is arranged in columns. Once the text has been selected, use the keyboard or the edit menu to delete it or move it to another location. Completing WordsThe 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. ![]() Moving to a Specific LineWhile editing, you can move to a specific line number as follows:
![]() Setting and Moving to BookmarksBookmarks are points of interest in a file. Komodo displays blue triangles on the left margin beside bookmarked lines.
![]() Viewing the Current File as Another LanguageKomodo'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 the Perl language option, 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:
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, it is recommended that 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. If you choose to view a file in a different language and then save the file, the original language will not be restored when you re-open the file. If you are unsure of the original language, you can select View|View As Language|Reset to best guess. Komodo will ignore the user preference, and analyze the file in an attempt to determine its language. ![]() Toggling Whitespace On and OffWhitespace 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:
You can also set a default for whitespace display. For more information, see Customizing Editor Features. ![]() Toggling Indentation Guides On and OffIndentation 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:
![]() Toggling Line Numbers On and OffLine numbers can help orient you when working in a long file. To toggle line numbers on and off:
You can also set this option globally. For more information, see Customizing General Editor Features. ![]() Toggling EOL (end of line) Markers On and OffEnd-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:
You can also set this to be on globally. For more information, see Customizing General Editor Features. ![]() Increasing and Decreasing the Code Font SizeTo increase the font size in the Editor Pane:
To decrease the font size:
When you save a file, the new font size is saved. ![]() Toggling Fixed and Non-Fixed Width FontIn Komodo, you can use fixed width or non-fixed width fonts for editing. You can also toggle between these settings. The default font is non-fixed width. Note that this setting does not persist. If you toggle to a different setting, the next time you open the file it will restore the width specified on the Fonts tab of the Fonts and Colors page in Komodo Preferences. To toggle between fixed and non-fixed width font:
![]() Folding and Unfolding CodeCode 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.
![]() Matching BracesUse 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. ![]() Selecting Blocks of CodeYou 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. ![]() Editor Context MenuRight-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, Select All, and Print commands, you can also choose from the following options:
![]()
|