Ted /
Filtering
Search:  


Table Of Contents (show)

  1. 1. Ted Filtering

1.  Ted Filtering

Filtering is probably the most powerful feature in TED. Filtering, very simply, is the external processing of text selected in the editor. To use it, simply highlight the relevant data and press <Control-backslash>. This will popup the filter dialog, and insert the selected text into it's window. The filter dialog supports various canned filters, or arbitrary Tcl can be used. See here for a screenshot.

The desired filter operation is selected from the menu. By default hitting <Return> in the entry dialog will process the selected filter, thereby inserts the results inline. If immediate-return is selected, then a single filtering will be performed and the result will replace the selection. Otherwise, multiple filterings may be performed.

Some filters may take values, which are entered in Option/Commands. The "%a" argument may be used, but if not the current value is just appended. Some examples follow.

Sort selected text as a Tcl list:

   # Highlight "baker charlie able"
   <Control-\> to  open the filter dialog.
   # Select "Sort" from list.
   # Outputs: "able baker charlie"

Execute Tcl a command on selected text:

   # Highlight "baker charlie able"
   <Control-\> to  open the filter dialog.
   # Select "Command" from list.
   # Type "string map {a A e E}" in input and hit enter
   # Outputs: "bAkEr chArliE AblE"

Execute Tcl a where data is not last argument:

   # Highlight "baker charlie able"
   <Control-\> to  open the filter dialog.
   # Select "Command" from list.
   # Type "lrange {%a} 1 end" in input and hit enter

© 2008 Peter MacDonald

Page last modified on November 06, 2007, at 01:38 PM