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.

 

Storing Files within a Project or the Toolbox

Files can be stored in a project, in the Toolbox, or within folders in a project or the Toolbox. Storing a file within a project or the Toolbox creates a reference to the actual file located on the disk; it does not affect the file itself. Therefore, the same file can be stored in multiple projects and folders, both in projects and within the Toolbox; changes to the original source file apply regardless of the source of the file reference; deleting a file from a project or the Toolbox does not delete the file from the filesystem.

While most file options (such as source code control commands, viewing unsaved changes, and refreshing the file status) are accessible regardless or whether or not the file is contained in a project or the Toolbox, some commands are specific to the project/Toolbox environment. These commands are described below.

 

Creating an Open Shortcut to the Current File Location

Open... shortcuts, stored within a project or the Toolbox, are references to filesystem directories. When an open shortcut is invoked, the standard Open File dialog box is displayed with the contents of the directory.

Open shortcuts can be created using a specific file as the context. Right-click a file in a project or the Toolbox and select Make "Open..." Shortcut. This creates an open shortcut to the directory where the file is stored.

 

Exporting Files as Projects

The Export as Project File option is used to create a new project file containing the file from which the option was invoked. To access this option, the file must be stored in a project or the Toolbox. Right-click the desired file name and select Export as Project File. You are prompted to provide the name of the new project file and the directory where it will be stored.

To open the new project file, select File|Open|Project.

 

Exporting Files to a Package

Files can be archived and distributed among multiple Komodo users via "packages". Packages are compressed archive files that contain the file from which the Export Package option was invoked. Packages are stored in files with a ".kpz" extension, and can be opened by any archiving utility that supports libz (for example WinZip). The Export Package option differs from the Export as Project File option in that copies of filesystem-based components (such as files and dialog projects) are included in the archive. Conversely, Export as Project File creates a project with a reference to the component's original location and does not create copies of the components. When Export Package is invoked, you are prompted for a name and file location for the package.

Exported packages can only be imported into "container" objects in Komodo, such as projects, the Toolbox, and folders within projects and the Toolbox. See Toolbox - Exporting and Importing Toolbox Contents, Projects - Importing and Exporting Projects via Packages, or Folders - Import Contents from Package for more information.

 

Opening Files

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

  • Command-Line Argument: When Komodo is invoked from the command line, files can be specified as open arguments. See Starting on Windows, Starting on OSX, or Starting on Linux for more information.
  • File|Open: Use the File|Open menu option.
  • Project Manager or Toolbox: Double-click, drag and drop, or use the file's right-click context menu to open a file contained in a project or the Toolbox.
  • Open/Find Toolbar: Use the Open/Find Toolbar. To display the Open/Find Toolbar, select View|Toolbars|Open/Find.
  • Most Recently Used List: The most recently opened files are displayed on Komodo's Start Page. This list is also accessible from the File|Recent Files menu. The number of files in the most recently used list is determined by the Appearance preference.
  • Drag and Drop: Drag and drop one or more files from another drag-and-drop application (such as Windows Explorer) onto the Komodo editor.

 

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

  • Pre-Configured Server Connection: If remote servers have been configured in Komodo's Preferences, select the name of the configuration from the Server drop-down list. Access the Server Configuration dialog box by clicking the Accounts button to the right of the Server field.
  • Manual Server Connection: Enter the server's fully qualified hostname in the Server field. Press 'Enter'. You are prompted to enter a name and password for the server. If the server is configured for anonymous access, select Anonymous login. To store the login name and password for the server, click Remember these values.

 

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.

 

Storing Remote Files in Projects or the Toolbox

When remote files are added to a project or the Toolbox, or to container components within a project or the Toolbox, they are accessed and organized in the same manner as local files (double-clicking a file opens it in the editor; right-clicking a file accesses file option, etc). Remote files can only be added to projects or the Toolbox by connecting to the remote server.

Login authentication is processed when the remote file is opened, or when it is added to the Toolbox or a project. For the duration of the Komodo session, the user name and password are remembered; closing and opening the file uses the same authentication information as the first time the file was opened. If authentication fails, you are prompted to enter a user name and password.

After closing and re-opening Komodo, the authentication information stored in the Servers preference is checked again. Thus, changes to the user name or password stored in the server configuration do not take effect until Komodo is closed and re-opened. If no authentication information is stored in the server configuration, you are prompted to supply it when you open the file.

See Adding Components to Projects or Adding Components to the Toolbox for instructions on adding remote files to the Toolbox or to projects.

To open a remote file, double-click the file name, use the assigned key binding, or right-click the file and select Open File.

 

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:

  • Key Binding: Use the associated key binding.
  • Editor Tabs: Click the tab with the desired filename.
  • Window Menu: On the Window menu, select Next File or Previous File to move from left to right (or right to left) across the file tabs. Alternatively, select the desired file from the list of files currently open in the editor.
  • Project or Toolbox: Double-click the filename.

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 key bindings are available in the "diff" window:

  • F8: Jump to the next change.
  • F7: Jump to the previous change.
  • F9: Jump to corresponding line. Opens and/or shifts focus to the original file in the Editor Pane. If viewing a diff in an editor tab, right-click and select Jump to Corresponding Line (or select Code|Jump to Corresponding Line) to shift focus to the editor tab containing the source code. Selecting this option opens the source code tab in the Editor Pane if it is not already open and/or shifts focus to the original file in the Editor Pane. (If viewing a diff in an editor tab, right-click and select Jump to Corresponding Line.)
  • Esc: close 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:

  • Perforce: analysis of the client configuration
  • CVS: analysis of the CVS control directories

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:

  • Editor Context Menu: Right-click a file in the editor and select Source Control.
  • File Tab Context Menu: Right-click a file tab above the editor and select Source Control.
  • Toolbox or Project Context Menu: Right-click a file in the Toolbox or Project Manager and select Source Control.
  • Toolbox or Project Menu: If a file is currently selected in the Toolbox or Project Manager, use the menu to access source code control commands for the selected file.

 

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:

  • Edit Menu: On the Edit menu, click Current File Settings.
  • Editor Context Menu: Right-click in the editor and select Properties and Settings from the context menu.
  • File Tab Context Menu: Right-click the tab above the editor that displays the filename, and select Properties and Settings.

 

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:

  • Attributes: Toggle the file's status between writable and read-only.
  • Language: This field displays the current language association (which affects language-specific options like syntax coloring and AutoComplete) for the current file. To change the language association, select another language from the drop-down list. To set the language association to the Komodo default (as configured in the File Association Preference, click Reset.
  • Encoding: Use this field to set the International Encoding for the current file.
  • Line Endings: Use this field to set the desired line endings for the current file. By default, Komodo preserves the line endings contained in a file when the file is opened. (Default line endings for new files are configured in the New Files preference.) If you select Preserve existing line endings, new lines are assigned the end-of-line character selected in the drop-down list, but existing lines are not be altered.

 

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.

  • File|Print|Print: Invoke the print function from the File menu.
  • Standard Toolbar: On the Standard Toolbar, click the Print button.
  • Editor Context Menu: Right-click the file and select Print.

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

  • Orientation: Select whether the printed output should have a portrait or landscape orientation.
  • Scale: If the Shrink To Fit Page Width check box is not selected, use this field to manually enter a percentage.
  • Shrink To Fit Page Width: Select this check box to make the print job fit the paper size selected for the default printer.
  • Print Background (colors & images): Select this check box to include background colors and graphics (e.g., on a web page) in a print job.

Margins and Header/Footer

  • Margins: Use the fields provided to enter the size of the margins in inches.
  • Headers and Footers: Use the drop-down lists to select the type of information that appears in the headers and/or footers, and to determine their position on the page. The top row of lists contains the header options, and the bottom row contains the footer options. Choose from options such as "Title", "URL" and "Page #". Select the "Custom" option from any of the drop-down lists to enter custom header information. To print without headers and footers, select the "blank" option in each of the drop-down lists.

 

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:

  • Key Binding: Use the associated key binding.
  • File|Save: Use the File|Save menu option to save the file that is currently displayed in the editor. To save the file to a different name, select File|Save As. To save all open files, select File|Save All
  • Standard Toolbar: Click the Save button on the Standard toolbar. To save all open files, click the Save All button.
  • File Tab Context Menu: Right-click the file tab and select Save. To save the file to a different name, select File|Save As.

 

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:

  • File Menu: Select File|Close or Window|Close. To close all open files, select Windows|Close All.
  • Key Binding: Use the associated key binding.
  • File Tab Context Menu: Right-click the file tab and select Close.
  • Editor: Click the "x" in the top right corner of the editor to close the current file.