Wily
Wily Idioms
This is a collection of useful scripts, guide files and ways
of working with Wily.
Guide files
Collect useful script names, file names, regular expressions
into a simple text file, which can act as a tool box/menu.
e.g.
my $h/lib/html/guide
|title |h1 |h2 |h3
|href http://
|mailto oz@cs.yorku.ca
|i |b |tt
|tag blockquote
|indent
and my $h/guide
remote rm guide |par |indent |undent :., :, W sam sg wdef 9term
Mace/in src/jcrab
news; overp comp.risks
$wilysrc $wilybin
I edit my $h/guide to have the names of files and directories
I'm frequently working with.
Start-up Script
Start Wily from a shell script which sets up the environment,
and initial files
#!/plan9/bin/rc
EDITOR=W # makes wily the editor for mail, etc.
path=(. $path) # add '.' to the path
exec wily $h/guide # use an initial 'guide file'
Short-cut Environment Variables
Set environment variables to make window labels
shorter and easier to type, e.g.
h = $HOME
wilysrc = $h/src/wily/wily
wilybin = $h/obj/$cputype/wily/wily
"buttons"
These are commands designed to operate on the window in which
they are clicked.
- Write a script which operates on $WILYLABEL, e.g.
createreplymessage $WILYLABEL
- Add a .wilytools entry so the name of the
script appears automatically in the tags of appropriate windows,
e.g.
Mace.*\$ subject
Mace reply
would ensure that all the subdirectories of Mace have a "subject"
button, and all the normal files in the Mace file tree have a "reply"
button.
wily tag
Use the wily tag (the tag above the columns) to store very
frequently used commands and addresses. This is particularly
useful because the wily tag is never obscured.
I normally copy the top line of my $h/guide file
to the wilytag as soon as I start Wily.
B3 to change "last selection"
B3 in the label of a window to make its body the last selection
without having to sweep the selection out again.
Plan to double-click
Put quotes or brackets around long commands you might want to
re-select later. It's just a bit easier than sweeping the
command out again.
double-click to check syntax
Double-click just inside a bracket or brace to find where
the other half of the matching pair is, e.g. to check if
you've got enough closing brackets.
double-click to select SGML elements
Double-clicking will select between >< pairs,
so given this text: "<H1>the heading</H1>",
double-clicking just before "the" will select "the heading".
address expressions in the wily tag
B3-ing in a tag with no body (i.e. the wily tag or a column tag)
searches for the address in the last selected window. This lets
you put common address searches (e.g. :, (select the whole window))
in the wily tag and apply them to a window by selecting the window,
then B3-ing in the address.
use history file(s)
Set $history and use it as a memory for obscure
commands you perform infrequently, and as a short-cut for
for commands you've performed recently.
I set $history based on the date. This gives me one file
with recent commands, and a directory full of files with older
commands. I use two history-printing commands, one called 'h'
which searches through the current history file, the other called
'hg' searches through all my history files, using
glimpse.
h
#!/plan9/bin/rc
if ( % $#* 0 ) {
tail $history
} else {
agrep $1 $history | tail
}
hg
#!/plan9/bin/rc
glimpse -H $h/lib/history -h -y -L 15 $*
remote interface to netscape
I call this script 'remote'
#!/plan9/bin/rc
for(i) {
netscape -noraise -remote 'openURL('^$i^',new-window)'
}
To use it, select one or more URLs, and B2B1 on 'remote'.
Netscape will then open a window on each of the URLs.
Look
- Use B2B1 on "Look" to search in one window for a symbol you have
selected in a different window
- Use "Look" to search for a symbol you can't search for with B3 because
its also the name of a file in "this" directory or the include path.
Backups
Edit and execute the "backup warning"
messages.
A typical one might be
backup 48 /n/staff/u13/pgrad/gary/guide
Replace the word backup with 'diff' and execute
the line to find out what changes were discarded.
Replace the word 'backup' with 'cp' to easily recover
the modified version of the file.
Poor man's hypertext
You can put the name of a related file in a comment, to
let you more easily jump between files. E.g. I have the
documentation for msg.h in C.html, so
each file has a comment referring to the other, e.g.
in msg.h,
/* see ../Doc/C.html for more extensive documentation */
and in C.html
<!-- documentation for msg.h -->
This makes it more likely that when I change one
file I'll just B3 in the name of the related file to jump to it.
oz@cs.yorku.ca