Komodo User Guide

Running External Commands

Komodo's Run Command dialog is used to interact with the system command line or shell while you are editing or debugging files. You can insert the results of shell commands into the document in the editor, or you can pass contents of the document to the shell prompt.

Select Tools | Run Command, or use the keyboard shortcut Ctrl+R, to open the Run Command dialog. Alternatively, invoke the Run Command dialog from the Project Manager or the Toolbox.

The Run Command Dialog

  • Enter the desired command in the Command field.
  • To insert the results of the command at the cursor position in your current document, check Insert Output.
  • To apply a command line function (such as a sort command) to a selection in the Komodo editor, select the desired text, then check Operate on Selection.
  • Check Add to Toolbox to save the command to the Toolbox.

Shortcuts

Shortcuts interpolate common strings into the command string. The following shortcuts are accessed by clicking the arrow button to the left of the Command field:

  • %%: escaped percent symbol
  • %f: file base name; interpolates the name of the file that is currently in focus in the Komodo editor
  • %F: file path; interpolates the full path and name of the file that is currently in focus in the Komodo editor
  • %d: directory base name of file; interpolates the name of the directory where the file that is currently in focus in the Komodo editor resides
  • %D: directory path of file; interpolates the entire directory path where the file that is currently in focus in the Komodo editor resides
  • %s: selection
  • %S: URL escaped selection
  • %w: word under cursor; interpolates the word from the current cursor position of the cursor
  • %W: URL-escaped selection or word under cursor
  • %(browser): command to launch browser; if no browser is specified in the Preferences, the system default will be used
  • %(perl): path and name of Perl interpreter as configured in the Preferences
  • %(php): path and name of PHP interpreter as configured in the Preferences
  • %(python): path and name of Python interpreter as configured in the Preferences
  • %(tclsh): path and name of tclsh interpreter as configured in the Preferences
  • %(wish): path and name of wish interpreter as configured in the Preferences

Advanced Options

  • Start in: specify the directory where the command should be run.
  • Run in: specify the environment in which the command should be run. The options are:
    • Command Output Window: the output from the command will be displayed in the Command Output tab in the bottom pane of the Komodo workspace.
    • New Console: the output from the command will be displayed in a new shell or command window.
    • No Console (GUI Application): the command will launch the specified application without displaying output to either a shell or command window or the Command Output tab.
  • Environment Variables: specify variables that should be passed to the command.
  • Save advance options as defaults: set the default future run commands.

Running Commands

To execute the command, click the Run button.

The last ten commands entered in the Run Command dialog can be accessed by selecting Tools|Recent Commands, or using the Alt+t, m, number keyboard shortcut (where "number" stands for the sequence number of the previous command). The prefixes [i], [l] and [il] indicate that Insert Output, Operate on Selection, or both (respectively) were used with the original command.