Macro/Shell Extensions

Shell Commands and Filters

The Shell menu (Unix versions only) allows you to execute Unix shell commands from within XNEdit. You can add items to the menu to extend XNEdit's command set or to incorporate custom automatic editing features using shell commands or editing languages like awk and sed. To add items to the menu, select Preferences -> Default Settings Customize Menus -> Shell Menu. XNEdit comes pre-configured with a few useful Unix commands like spell and sort, but we encourage you to add your own custom extensions.

Filter Selection... prompts you for a Unix command to use to process the currently selected text. The output from this command replaces the contents of the selection.

Execute Command... prompts you for a Unix command and replaces the current selection with the output of the command. If there is no selection, it deposits the output at the current insertion point. In the Shell Command field, the % character expands to the name (including directory path), and the # character expands to the current line number of the file in the window. To include a % or # character in the command, use %% or ##, respectively.

Execute Command Line uses the position of the cursor in the window to indicate a line to execute as a shell command line. The cursor may be positioned anywhere on the line. This command allows you to use an XNEdit window as an editable command window for saving output and saving commands for re-execution. Note that the same character expansions described above in Execute Command also occur with this command.

The X resource called nedit.shell (See "Customizing XNEdit") determines which Unix shell is used to execute commands. The default value for this resource is the user's login shell.