✩‿✩ Filter Through Command
A Redcar Editor plugin for manipulating and displaying text using shell commands
Filter Through Command supports running the current line of a document as a shell script, as well as manipulating and displaying text using several options for input and output.
Version 1.0 supports Redcar 0.8 and above, versions 1.1 and beyond support Redcar 0.12 and above only.
Redcar v0.12 and above:
gem install redcar-filter-through-command
alternately, you can install from source:
Redcar v0.8 to v0.11:
Download a build from the Downloads section and copy to
~/.redcar/plugins, or build from source:
cd ~/.redcar/plugins git clone git://github.com/kattrali/redcar-filter-through-command.git filter_through_command git fetch origin --tags git checkout 1.0 # or 1.1, etc
Running the current line or selection as a shell script
Plugins > Filter Through Command > Evaluate Text to run the cursor line or selection as a shell script.
Filtering text through a shell script
Plugins > Filter Through Command > Open Speedbar... to view command filtering options.
Execute button or press
Return in the Command field to run a shell command with the selected options. To rerun the last used filter options, select
Plugins > Filter Through Command > Re-run Last Filter, or use the keyboard shortcuts.
Autocompletion is available for recently run commands, and the 10 most recent commands are available from the Command menu.
|None||Run a command without input|
|Cursor Line||Run a command using the text of the cursor line as input|
|Cursor Word||Run a command with the word containing the cursor as input|
|Document||Run a command with all of the text of the current document given as input|
|Selection||Run a command with the selected text or the cursor line text given as input|
|Create new Document||Insert output into a new document|
|Insert as Text||Insert output into the current document at the cursor|
|Open as URL||Open the output in a web browser as a URL|
|Replace Document||Replace the entire document with output|
|Replace Selection||Replace the selected text with output|
|Show as HTML||Open the output in a new HtmlTab or in the default browser|
|Show as Popup||Open the output in a popup dialog under the selected text or cursor line|
|Show as HTML Popup||Open the output in a popup dialog formatted as HTML|
Filter through Command also provides substitution variables for commonly needed text in commands. Substitutions can be further shortened to # + lower case first letter. (Scope being the exception, instead using
|DOCUMENT (#d)||All of the text of the current document|
|LINE (#l)||Text of the cursor line|
|FILE_PATH (#f)||The file path to the current document|
|SELECTION (#s)||Text of the current selection|
|TEMP (#t)||A new empty file, which is afterwards opened by Redcar|
|WORD (#w)||Text of the word containing the cursor|
|SCOPE (#c)||The current scope of the cursor|
Extending this Plugin
Additional output types can be added by subclassing
FilterCommand::OutputFormat and implementing the
format(text,type) methods, then including the new class in a Redcar plugin. Examples can be found in
Converting HTML to Haml
Using Variable Substitution