Index  Menus  Panels  Troubleshooting  Key glossary  Glossary
Text rulers  Language  Text shortcuts  Fonts  Size and gadgets  Colours

The external commands panel

The external commands panel

Select External commands... (Edith menu, Shift Ctrl X) to open the external commands panel, where you can enter shell commands that get an entry in the Edith menu, and can be assigned a function key.

Commands can be defined for each text window mode. The commands for Default setup are always available, and are assigned function keys F1-F20. Commands for the other modes, such as LaTeX, are available only in windows for that mode, and have function key combinations Ctrl F1 - Ctrl F20. In the commands panel, switch between these modes through the pop-up menu at the top of the panel.

The scrolling list in the top right corner of the panel shows the names of the commands in the order in which they will appear in the Edith menu. The order can be changed using the down and up buttons; use the separate button to put sets of external commands of a similar nature into groups.

The lower half of the panel shows the parameters for the command selected in the list. To replace a selected command entirely by a new definition, change the values and click replace. If either the name or the command line have been changed, but one of them remains the same, use Enter. Use Enter also to enter a new command that is not yet in the list.

The meaning of the parameters in the panel is best explained by looking at the commands that are automatically installed when you first use Edith.

Commands for Default setup

Number lines (F1)
On text windows only; numbers selected lines, or the entire text if there is no selection.

Calls the nl program, that takes a number of lines as its standard input, and produces on its standard output the same lines prefixed with numbers. The switch takes selection as input is selected, so when calling this command from the Edith menu or by hitting F1, the selected text is sent to the standard input of nl. Default scope is set to text, so when there is no selection, the entire text will be selected and sent to nl. Cmd output: Substitute is selected so that the output of nl will be substituted for the selection.

Quote (F2)
Quote selected text (as in an email message), or a paragraph if there is no selection.

Definition is nearly identical to number lines, except that default scope is now paragraph. The command itself is not a simple UNIX command like nl, but an awk (1) script, that prefixes its input lines with >. On Linux systems, check gawk (1).

Centre lines (F3)
Centre selected lines; default scope: paragraph.

Analogous to quote.

Transpose characters... (F4)
Calls the tr program on selected lines of text; defaults to a paragraph. A box pops up for the user to confirm the transposition patterns. Default action is to swap case.

By default, this command swaps upper and lower case. However, because ask confirmation of command and directory is selected, a confirmation box will pop up when Transpose characters is selected or F4 is pressed. In this box, the transpose pattern `a-zA-Z' `A-Za-z' passed to the tr program is selected. This preselection is specified in the external commands panel by the use of the special variable %cursor in the command's definition. %cursor marks the cursor position, or when used twice, the left and right end of the selection in the confirmation box.

The transpose pattern consists of two sets of characters; characters in the first set will be replaced by those in the second. See tr (1) for details. Because the sets are preselected, you can change them immediately by typing two new sets. What you have typed to replace the preselected patterns will automatically pop up again the next time you call transpose characters, provided that you made changes only to the preselected text.

Following a good custom, the menu entry for this command ends in an ellipsis (...), to indicate that a panel will be opened when the command is selected, requiring further information from the user.

Sort from cursor (F5)
Sort selected lines from the current cursor column. Using this function requires a bit of practice. Select 10 lines with the mouse, move inside the lines with the cursor keys, move to the column which contains the data to be used as the sorting key, and hit F5. Default scope is entire text. Calls sort +number. New is the use of the variable %col, which is replaced with the current cursor column. A variable %row is also available.
Sort numerically (F6)
Sort selected lines numerically (from beginning of line). Default scope is entire text.
Remove duplicate lines (F7)
Removes consecutive identical lines, by calling the program uniq.
Evaluate expression... (F8)
Evaluate the selected numerical expression (e.g. (3 + 4) * 5), and display it in a browser window. If there is no selection, looks at one line.

Calls the program bc. New is the setting cmd output: to window, that instead of replacing the selection, sends the output of the command to a new (browser) window.

Following a less obviously good custom of the developer of Edith, the menu entry of this command also ends in an ellipsis, even though the window that pops up when the command is executed does not require user interaction. But the command definitely causes a new window to be opened, and that too deserves some form of indication.

Count words... (F9)
Count the number of selected bytes, words and lines, or when there is no selection, the number of bytes, words and lines in the whole text. Calls the wc command.
Spell... (F10)
A simple spell checker. Produces a list, in a new window, of words which are in the selected text, but do not appear in the standard system dictionary.

Calls the ispell (1) command with the option -l, sorts the result and removes duplicate lines. This is equivalent to ispell's predecessor spell (1); however, spell is no longer present on all UNIX systems (Linux slackware).

Fgrep and open... (F11)
Pops up a box where a search string and a set of files is preselected. Type the search string and the file names as you would do for fgrep (1) , and hit Enter. Edith will then open all of the specified files that contain the search string, with the cursor at the first occurrence of the string. You can proceed searching for the string with Next target below (Browse menu, Ctrl G).
Print... (F12)
Calls lpr, with a confirmation. New is cmd output: ignore.

Commands for HTML

Preview... (Ctrl F11)
Opens an Edith browser window on the HTML file you are editing.

Commands for LaTeX

Comment out (Ctrl F1)
Puts comment signs (%) before the selected lines.
Comment in (Ctrl F2)
Removes comment signs (%) before the selected lines.
LaTeX... (Ctrl F5)
Runs LaTeX on the current file (but pops up a box where you can change the name of the source file and the directory).

New is the use of Save file before command that causes the text in the window from which this command is selected to be saved before make is executed.

BibTeX... (Ctrl F6)
Runs BibTeX on the current file.
Open log file... (Ctrl F9)
Opens the log file for the TeX file you are editing.
Preview... (Ctrl F11)
Opens xdvi (1) on the current TeX file.
Print... (Ctrl F12)
Prints the current TeX file using dvips (1) and lpr (1).

Commands for C/C++

Comment out (Ctrl F1)
Puts comment signs around the selected lines.
Comment in (Ctrl F2)
Removes comment signs around the selected lines.
Make... (Ctrl F5)
Calls make (1), with a confirmation box; the current file is saved before the command is executed.
Make clean... (Ctrl F6)
Runs make clean.
Open header file... (Ctrl F9)
Opens the header file for the the C file you are editing (i.e., the suffix .c is replaced with .h).
Open C file... (Ctrl F10)
Opposite of open header file.

CONFIRMED COMMANDS

Some of the commands do not execute immediately, but pop up a box asking you to confirm the command and the directory where it is executed. The first time you run the command, its directory is set to the directory belonging to the window you call it from. On subsequent times you run it, the previous directory will be preselected in the confirmation box. If you make changes to the command itself however, these are not remembered, unless part of the command line was preselected using %cursor, in which case modifications to the preselected part of the command are stored.

VARIABLES

The variables allowed in the command field have been discussed at length in the examples. A summary:
%name
The short name of the text file; left unexpanded if the command is not called from a text window. In the case of a command with ask confirmation of command and directory, the name is relative to the last given directory.
%name{.suffix}
The short name of the text file, with .suffix removed, if it ends in .suffix.
%fullname
The full path name of the text file
%cursor
Useful only if ask confirmation of command and directory is switched on. Specifies the position of the text cursor within the confirmation box. If used twice, specifies the beginning and the end of a preselected part of the command (usually a parameter).
%row
Expands to the current cursor row.
%col
Expands to the current cursor column.
%%
Expands to a single %.

Index  Menus  Panels  Troubleshooting  Key glossary  Glossary
Text rulers  Language  Text shortcuts  Fonts  Size and gadgets  Colours