Working with Files

Komodo provides a variety of methods for accessing and editing files. While files can be opened and edited individually, they can also be stored in projects or the Toolbox as components.

If Komodo is configured to integrate with a source code control system (SCC), status icons beside the filenames indicate the file's current SCC status, and SCC options are available from the File menu and the right-click context menus. This integration is described in detail in the Source Code Control section of the Komodo documentation.

Files are manipulated in various ways: via the File menu, via context menus in the editor, via context menus on the file tab (above the editor), and as components within projects and the Toolbox.

This document describes file functionality, such as opening, printing, and saving files. See the Editing page for information about editing files.

Creating Files

To create a new file, click the "New File" button on the standard toolbar. (To display the standard toolbar, click View|Toolbars|Standard.) A new file with the default file extension for the file type is created and opened in the Komodo editor. Use the New Files page in Komodo's Preferences to specify the default file extension for new files.

Creating Files from Templates

New files can be created based on pre-defined templates that contain default content for specific file types. See the Templates documentation for information about configuring custom templates.

To create a new file from a template, select File|New|File. The New File dialog box contains numerous pre-defined templates organized into categories. Select the desired category, then select the desired template within that category.

Click Open to create a file with the contents of the template file. The file is loaded in the editor.

The File|New|File menu displays a list of the most recently accessed templates. To alter the number of template files displayed, refer to the New Files page in Komodo's Preferences.

To add a template to the Toolbox for quick access, select the desired template and click Add to Toolbox.

Opening Files

There are numerous methods for opening files in Komodo. These include:

Go to File (Fast Open)

The Go to File dialog is an alternative to the system native "Open File" dialog. It typically makes it faster to find and open files. File names are gathered from a number of sources. A filter box allows you to quickly filter this list down to the file you are looking for. You can then open an item by pressing 'Enter' or double-clicking on the filename. File names sources are (configurable in the "Fast Open" preferences panel):

File name filtering works as follows:

Opening Files with the Open/Find Toolbar

The Open/Find Toolbar provides quick access for opening files and finding strings. The toolbar is displayed in Komodo by default. To hide or show the toolbar, select View|Toolbars|Open/Find.

Use the Open field on the Open/Find Toolbar to open one or more files in the filesystem. The Open field generates a drop-down list of files and directories as you navigate the hierarchy. To open a file, enter the file path and name, and then press 'Enter'.

For example, to open a file named "debug.txt" in the directory C:\temp\log on a machine running Windows, enter C:\tmp\log\debug.txt in the Open field and then press 'Enter'. As you enter each backslash, a drop-down list displays the files and directories beneath the current directory.

Enter "./" or ".\" in the Open field to display a list of files and directories in the "current" directory. The current directory is determined as follows:

  1. Current File: If a file is open in the editor, the directory where the file is stored is the current directory. If multiple files are open, the file that is currently displayed is the current file.
  2. HOME Variable: If no files are open, Komodo checks if the system has a defined HOME environment variable. If so, the directory specified in that variable's value is the current directory.
  3. Filesystem Root: If neither of the above conditions is met, the system's root directory is used ("C:\" is the default on Windows, and "/" is the default on Linux and Mac OS X).

To narrow the results in the list box, enter one or more characters in the name of the file or directory you wish to open or view. (The search is case-sensitive.) Alternatively, use the arrow keys to navigate the drop-down list. The contents of the Open field are updated as you move up and down the list with the arrow keys.

Note that you can use standard directory navigation syntax to change directories. For example, if the current directory is /home/fred/tmp/foo, change to the /home/fred/tmp/bar directory by entering ../bar.

To open a file, press 'Enter' when the file name is displayed in the Open field. To continue navigating the directory structure, append a frontslash or backslash to the directory name displayed in the Open field; the drop-down list is updated with the list of files and directories that exist under the current location.

To open multiple files, specify a wildcard ("*" for a file name segment, "?" for a specific character). For example, to open all the files with the extension ".tcl" in the directory /home/fred/tmp, enter /home/fred/tmp/*.tcl.

At any time, press the 'Escape' key to return focus to the Komodo editor.

Opening Remote Files

Komodo can open files located on remote machines, providing that the remote machine is configured for FTP, FTPS, SFTP, or SCP access. To quickly access frequently used servers, create an entry in the Server Preferences (Edit|Preferences|Servers).

To open a file located on a remote server, select File|Open|Remote File.

Connecting to a remote server

Using Public Key Authentication

Komodo supports public key authentication through external key agents like ssh-agent (inlcuded with the OpenSSH distribution) and Pageant (a companion utility for Putty). This allows you to access remote files over SFTP or SCP without entering passwords.

Information on configuring public key authentication with source code control (CVS and SVN) can be found in Configuring SSH Support for CVS and Subversion.

Navigating the Remote File System

After establishing a connection to the remote server, a list of files and directories is displayed. These files and directories exist under the directory specified in the Look in field. Double-click a directory (indicated by a file folder icon) to navigate the directory structure. Use the navigation buttons in the top right corner of the dialog box to navigate the remote filesystem.

To open a single file, double-click the filename. To open multiple files, hold down the 'Ctrl' key while clicking multiple files, then click Open.

The buttons in the top right corner of the dialog box perform various file and directory manipulation functions. Hover your mouse pointer over the buttons for a description of their functions. To delete or rename a file on the remote server, right-click the filename and, with the left mouse button, select the desired command on the context menu.

Opening Mapped URIs

Mapped URIs can be opened by dragging a mapped link from a browser into Komodo. For example, if you mapped the URL http://www.example.org/ to the local directory /var/www/, you could drag a link like http://www.example.org/projects/test.html from a browser into Komodo, which would open the local file /var/www/projects/test.html

This feature also works with URIs mapped to remote filesystems (via FTP, SFTP or SCP), which in turn can be configured for automatic authentication under Edit|Preferences|Servers.

Switching Between Files

To switch between open files in the editor:

If more files are opened than can be displayed by file tabs, click the right and left arrow buttons located in the top right corner of the editor to view the tabs of all open files.

To re-order the position of the file tabs, drag and drop the tabs into the desired positions.

For more information about working with the editor tabs, see Editor Tab Display in the editor documentation.

Comparing Files

Komodo includes a "diff" mechanism used to compare files. To compare two files using Komodo's "diff" window:

  1. Select Tools|Compare Files.
  2. By default, the path and file name of the file currently displayed in the editor is the first file for comparison. As desired, alter this selection by entering an alternate path and file, or browse for the desired file using Browse button. Use the same mechanism to specify the second file.
  3. Click Compare Files. The contents of both files are displayed in the "diff" window.

If the file is stored in a project or the Toolbox, this function can also be invoked by right-clicking the file and selecting Compare File With.

The unique characteristics of each file are displayed in different colors (red and blue by default); common characteristics are displayed in a third color (black by default). To configure custom colors for the "diff" window, alter the Language-Specific Coloring setting for the Other|Diff language in the Fonts and Colors preference.

The following buttons (and default keybindings) are available in the "diff" window:

A right-click context menu is also available with the following additional options:

Pressing 'Esc' closes the window.

Refreshing File Status

The Refresh Status option checks the read/write disk status for the component. If the file is of a language for which "code intelligence" is supported and enabled (as configured in the Code Intelligence Preferences), Refresh Status also updates the code intelligence database with the contents of the file.

If the component is stored in a source code control system, Refresh Status also checks the repository status of the file. Komodo determines whether a file is contained in an SCC repository by the following methods:

To refresh the file status of the current file, right-click the file tab or right-click within the editor and select Refresh Status. The same option is available on the right-click context menu of files in projects or within the Toolbox.

Source Code Control

Komodo provides source code control support for files stored in CVS or Perforce repositories. Source code control support (including SCC configuration, status icons and specific commands) is described in detail in the Source Code Control section of the documentation. To access source code control commands:

File Properties and Settings

In addition to the Komodo's global Preferences, some preferences can also be configured on a per-file basis. These settings override the global and project level preferences. To access the Properties and Settings dialog box for a file:

File Properties

The Properties category in the Properties and Settings dialog box displays general information about the file, such as the directory where it is stored, the size and creation and modification dates. The following file characteristics can be modified on this tab:

For HTML and XML documents, two additional settings are available:

Komodo tries to determine these values from the document's XML declaration. If the document does not have one, the DOCTYPE and namespace can be manually set here, enabling appropriate XML autocompletion. XHTML 1.1 is the default if no declaration or settings are present.

File Source Control Settings

If Komodo is configured to work in conjunction with a Source Code Control system, the Source Code Control category displays the current SCC status and settings.

File Editor Settings

The options on this tab are a subset of the General Editor and Smart Editing preferences. Refer to those sections of the Preferences documentation for information about individual options.

Indentation Tab

The options on this tab are a subset of the Indentation Preferences. Refer to that section of the Preferences documentation for information about individual options.

Browser Preview

This option configures the behavior of the Preview in Browser function. When the Preview in Browser function is invoked, you are prompted to specify the file or URL used to preview the current file. (For example, when previewing a CSS file, specify an HTML file to use for the preview.) The Preview in Browser dialog box has an option for remembering the specification. If that option is enabled, the file or URL specified is displayed in the Preview field. Click Change to alter the preview file.

Printing Files

To print the file that is currently displayed in the editor, use one of the following methods. These methods invoke the standard system dialog box for printer selection and configuration. Advanced print functions are described below.

Printing style is configured on the Printing page in Komodo's Preferences. Alternatively, select File|Print|Print Settings to display the Printing preferences page.

To display a preview of the printed output, select File|Print|Print Preview.

Select File|Print|Print Preview contains features for setting the scale and orientation of a print job. Use the arrow buttons to move forward or backward in a multi-page print job, or enter a specific page number in the field provided. Click the Page Setup button to access the complete set of print features in the Page Setup dialog box.

To print a selection of text rather than the entire file, select the desired text in the editor, then select File|Print|Print Selected Text.

Page Setup

Manage the format of print jobs using the options available in the Page Setup dialog box. Select File|Page Setup to access these options.

Format and Options

Margins and Header/Footer

Print to HTML File

To generate an HTML file from the file currently active in the editor:

  1. On the File menu, click Print to HTML File. You are prompted to name the output file.
  2. Enter the file location in the field provided. Click OK. The HTML file opens in the editor.

To print a selection of text to an HTML file (rather than the entire file), select the desired text in the editor, then select File|Print|Print to HTML File.

Saving Files

Komodo is "intelligent" about saving files. For example, Komodo prompts to save unsaved files on close. Attempting to save changes to a file that is set to read-only displays a dialog box where you are given the option to change the status or to "force" the save (which makes the file writable, saves the changes, then sets the file back to read-only). In addition, Komodo can be configured to automatically save a backup copy of files open in the editor. To configure Komodo's save functionality, use the Save Options preference page.

To save a file with its current name, do one of the following:

Saving Files Remotely

To save a copy of the current file to a remote server, select File|Save Remotely As. The Remote File dialog box is displayed. When editing files located on a remote server (including remote files stored in a project or the Toolbox), saving the file automatically saves it to the remote location.

Show Unsaved Changes

Before saving a file, view the changes in the file since it was last saved by using the Show Unsaved Changes option. To invoke this option, right-click within the editor (or on the file tab above the editor) and select Show Unsaved Changes. An external window displays the differences between the current version of the file and the disk version (e.g., the version that was last saved).

The unique characteristics of each file are displayed in different colors (red and blue by default); common characteristics are displayed in a third color (black by default). To configure custom colors for the "diff" window, alter the Language-Specific Coloring setting for the Other|Diff language in the Fonts and Colors preference.

Reverting Files

To abandon changes made to a file since it was last saved, but leave the file open in the editor, select File|Revert.

Closing Files

To close one or more files, use one of the following methods: