sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
* 9menu and sam
@ 1995-02-21 19:08 hc05
  0 siblings, 0 replies; only message in thread
From: hc05 @ 1995-02-21 19:08 UTC (permalink / raw)
  To: Sam mailing list

I read the excellent article on the UNIX Plan 9 tools this weekend and realized
that I can extend sam.  I understand why basic sam doesn't have macro
capability, but there are some things that I do a lot that would be nice
to do with the mouse.  I use samx2, and wouldn't use sam without it, but while
it has macro capability, I'm not big on learning lots of arbitrary key
sequences, even my own.  For these reasons I've put together a 9menu containing
some basic sam commands that I need.  When I want one, I go out to the 9wm
menu, bring up 9menu, and make my choice.  It has made things much easier.

I include the script here in case anyone is interested.  Some of the specific
macros may be useful to others, and some will only be meaningful to me, but
I figured I would include some examples.  I wrote this in perl because I 
haven't gotten far enough into the 9 tools to use rc.



($name) = getpwuid($>);
$pipe = '/tmp/.sam.'.$name.'.'.$ENV{'DISPLAY'};
$pipe =~ s/:0$/:0\.0/;
$pipe =~ s/\.0$// if (! -r $pipe);
exit if ($pipe =~ /^\s*$/);
$ENV{'SAMPIPE'} = $pipe;
exec "9menu", "-label", "sam menu", "-popdown",  "-iconic",
	"-geometry", "+0+0",
	'dashed line:echo "i/----------------------------------------------------------------------\\\\\n" >'.$ENV{'SAMPIPE'},
	'eroff memo template:echo "r $T/ermemo\n,x/Your_name/c/B. Konarski" >'.$ENV{'SAMPIPE'},
	'eroff preview:echo ",>preview" >'.$ENV{'SAMPIPE'},
	'eroff print:echo ",>tbl -D | eroff -mm -mr" >'.$ENV{'SAMPIPE'},
	'format:echo "|fmt" >'.$ENV{'SAMPIPE'},
	'shift left:echo "x/^	/d" >'.$ENV{'SAMPIPE'},
	'shift right:echo "x/^/a/	/" >'.$ENV{'SAMPIPE'},
	'spell:echo ",|cspell" >'.$ENV{'SAMPIPE'},

Beirne Konarski                 | Reading maketh a full man, conference a            | ready man, and writing an exact man.
"Untouched by Scandal"          |       -- Francis Bacon

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-02-21 19:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-02-21 19:08 9menu and sam hc05

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).