[manual index][section index]

NAME

wm/run - run shell commands

SYNOPSIS

wm/run [ -dMC ] [ -f font ] [ cmd ... ]

DESCRIPTION

Wm/run reads commands and executes them using the shell. It reads input and write it to the programs, and reads their output and displays it. It is similar to wm-sh(1) but with several distinctive features:

Options:
If cmd is given on the command-line, it is executed as first command.

-d
Enable debug prints.
-f font
Use font for the text and input widgets.
-M
Do not show markup in output. With markup, commands and exit statuses are printed (in color), and stdin/out/err are printed in blue, white, orange respectively.
-S
Do not automatically scroll the text view.

Interface
Wm/run shows input written to commands and output read from commands to the main text area. When completing a file name, this text area is temporarily replaced by a text area showing the completion matches. At the bottom of its window is an input entry. Commands and input are read from this entry. To the left of the entry is a small rectangle. Its color indicates the state of a running program (if any):

gray
No command yet, next line will start the command.
green
No reads from, or writes to the command are pending
blue
Only reads from the command are pending.
red
Only writes to the command are pending.

This rectangle also holds a character that indicates how text typed in the input entry is processed. If nothing is shown, text is simply added to the input entry at the cursor position (insert mode).


x
Next character is interpreted as a control-x command. Mode is then returned to insert mode.
[
Next character is interpreted as (part of) a vi command.
r
Console is in raw mode, characters are written to the command immediately when then are typed, and are not shown.

COMMANDS

Shell commands can be started by typing them at the input entry and hitting return. Several convenient keyboard shortcuts have been implemented, some starting with ^x (control-x). If the cursor focus is in the text area ^t brings it back to the input entry.

Del
Kill the current command.
Page up and page down
Scroll the text area up/down a page.
Home and End
Scroll the text area to make the start/end of the command become visible.
Up and Down
Navigate command input history to previous and next commands.
tab
Complete the file name at the word under cursor.
^v<char>
Insert literal char. Useful for executing commands with literal tab or newline. Shell quoting rules must still be obeyed.
^d
Send end-of-file to running program. When no program is running, quit wm/run.
^x p
Plumb the text in the input entry. Delete the text if the plumb message found a destination. Handy in combination with file name completion.
^x \n
Run the program in the input entry with the current selection as sole input.
^x x
Toggle the debug flag.
^x .
Run lc to compactly display the contents of this directory.
^x F
Compactly display all files in the file tree by calling find(1).
^x f
Compactly display most files in the file tree.
^x d
Compactly display only directories in the file tree.

Menu
Clicking with button 2 on the text area shows a menu. It holds four entries:

clear
Clears the text area.
scroll/noscroll
Toggles automatic scrolling when text is appended. The text area is only scrolled when its last line was visible before the new text was appended.
markup/nomarkup
Toggles showing colors and exceptions.
send
Act as if the selected text, or the snarf buffer if there is no selection, was typed in the input entry.

INPUT

The input entry accepts most standard Inferno Tk bindings, but also has a vi-like editing mode inspired by set -o vi found in various korn shells. Below, the modification and motion commands are described summarily. Familiarity with editing in vi is assumed. Although not further documented, many commands accept numeric repeat modifiers. Vi-mode is indicated by a [ to the left of the input entry.

[iIaA]
Change to insert mode.
[sSC] and cc or c<motion>
Substitute (delete text and change to insert mode).
r<char>
Replace character under cursor by char.
Y or yy or y<motion>
Yank text to the internal buffer.
p or P
Paste text from the internal buffer. The internal buffer is set by the yank command and to text deleted by modification commands.
.
Repeat previous command (insertions cannot be repeated).
u and ^r
Undo and redo changes, multiple levels implemented.
j and k
Navigate through command input history. Only commands (not input for running commands) are stored in history.
<repeat>G or <repeat>gg
Jump to position repeat in the command/input history.
D or dd or d<motion>
Delete text.
x or X
Delete character under or before cursor.

The remainder are motion commands, they only change the cursor and can act as modifiers for modification commands.


^
To first non-blank of line.
0
To first character of line.
$
To last cursor position of line.
[wWeEbB]
Navigate words. [wWeE] move forward, [bB] backward. [wW] stop before a new word, [eE] stop after a new word. [web] consider a words to be separated by whitespace or punctuation. [WEB] consider words to be separated only by whitespace.
h
Move one character left.
l
Move one character right.
<repeat>|
Move to character repeat.
%
Jump to matching closing or opening character, one of [{(]}), taking nesting into account.

MOUSE

Chording works in the text areas and the input entry. Chording in the input entry switches to insert mode and records the input entry text before the chord, for undo/redo. Plumbing with button3 is supported too. The selection or word under the mouse release is plumbed, taking off a trailing colon (from separating file names with line numbers from an error message) when an initial plumb message did not find a destination.

If the path to be plumbed is a directory, the command cd $dir && lc is executed instead. If a command is already running, the new command is started in a new instance of wm/run.

SOURCE

/appl/wm/run.b

SEE ALSO

sh(1), wm-sh(1), lc(1), mc(1), find(1).

WM-RUN(1 ) Rev:  Wed Feb 22 04:14:06 GMT 2023