====== function, reply and prompt ======
|x| Tutorial [ ] Guide [x]|
===== function (fn) =====
^#^Examples^
|**1.**|…[[resources_for_website_builders#editing_text|“vim”]] and “emacs” which offer an unmatched degree of customization.|
|//a.//|''fn vim { sam $* }''|
|**2.**|//Grep, but force listing of filename:lineno so you can click on an entry to jump to it in an editor.//|
|//a.//|''fn gn { grep -n $* /dev/null }''|
|**3.**|//Tree enumerator (simple "find") useful for many purposes//|
|//a.//|''fn f { du -a $* | sed 's/^.*// ((This whitespace is a tab.))////g' }'' ⇐ that whitespace is a tab|
|**4.**| [[plan9front_-_acme_sam_abaco_mothra_and_man#acme|acme]] |
|//a.//|''fn acme { /bin/acme -b -c 1 $* }''|
**Example #1:**
cpu% lc profile.edit
profile.edit
cpu% sam -d profile.edit
-. profile.edit
/fn
fn
fn term%{ $* }
/fn
fn
fn cpu%{ $* }
a
fn vim { sam $* }
.
w
profile.edit: #991
q
cpu%
=== whatis vim: ===
cpu% whatis vim
fn vim {
sam $*
}
cpu%
===== reply with selected text =====
|x|''|ireply'' is mentioned as an rc example, while an ''acme'' **Reply** is available.|
=== ireply: ===
#!/bin/rc
awk '{ print "> " $0}'
|1.|select text to include in reply with button 1|
|2.|//type ((Prepend ''ireply'' with the pipe (''|'').))// **''|ireply''** in message tag and run with button 2|
|3.|run **''reply''** in message tag with button 2|
|4.|use the button 1,3 chord to paste text into reply|
|5.|remove Include: line from message and type your reply.|
Start acme to access the mbox.
% acme
^Newcol Kill Putall Dump Exit^^^
|**New Cut Paste Snarf Sort Zerox Delcol**|:::|
^Newcol Kill Putall Dump Exit^^^
|**New Cut Paste Snarf Sort Zerox Delcol**|:::|⇐ Add //Mail// by typing ''Mail''.|
^Newcol Kill Putall Dump Exit^^^
|**New Cut Paste Snarf Sort Zerox Delcol Mail**|:::|⇐ Mouse button 2 press //Mail//.|
^Newcol Kill Putall Dump Exit^^^
|**New Cut Paste Snarf Sort Zerox Delcol Mail**|
|**///mail/fs/mbox//** **Del Snarf : Look Put Mail Delmesg Undelmesg Next**|
|2/|:::|⇐ An Email messages is here. Mouse button 3 press #2.|
|1/|
|**///mail/fs/mbox/2///** **Del Snarf : Look Reply all Mail Delmesg Save |ireply**|:::|⇐ Add //|ireply// by typing ''|ireply''. Mouse button 2 press //|ireply// after highlighting the text (below) to include in the reply, then mouse button 2 press //Reply//.|
|From: ne1nb00k@9p.sdf.org|
|To: ne1nb00k@9p.sdf.org|
|Date: Fri Jun 24 23:06:59 +0000 2022|
|Subject: practice reply|
|[blank]|
|That was some good neinbook!|
|[blank]|
|> Some text to reply to|:::|⇐ This is the text highlighting example area.|
|[blank]|
|Other text|
|Other text|
=== whatis ireply: ===
cpu% whatis ireply
/bin/ireply
cpu%
===== prompt =====
cpu% cp $home/lib/profile $home/lib/profile.bak
^#^Examples^
|**1.**|//To set your prompt in rc to reflect your current directory add this to your profile.//|
|//a.//|''fn cd { builtin cd $* && prompt=(`{pwd}^% '' ) }''|
|**2.**|//If you make frequent use of cpu's -''h'' and ''-u'' arguments, this variant keeps track of the host you are connected to, and as which user://|
|//a.//|''prompt = (`{cat /dev/user}^@^`{cat /dev/sysname}^'% ' ' ')''|
|//a.//|''fn `{echo $prompt(1) | tr -d ' '} { $* }''|
|**3.**|A Plan 9 Boot Camp user contributed prompt.|
|//a.//|''prompt=('['^`{pwd}^'] '^$sysname^'% ' ' ')''|
|//b.//|''fn cd {builtin cd $* && prompt=('['^`{pwd}^'] '^$sysname^'% ' ' ')}''|
**Example #1:**
cpu% lc profile.edit
profile.edit
cpu% sam -d profile.edit
-. profile.edit
/fn
fn
fn term%{ $* }
/fn
fn
fn cpu%{ $* }
s/cpu%{ \$\*/cd { builtin cd $* \&\& prompt=(`{pwd}^% '' )
.
fn cd { builtin cd $* && prompt=(`{pwd}^% '' ) }
w
profile.edit: #1007
q
cpu%
=== whatis cd: ===
cpu% whatis cd
fn cd {
builtin cd $* && prompt=(`{
pwd
}^% '')
}
cpu%