sam-fans - fans of the sam editor
 help / color / mirror / Atom feed
From: hc05@summitis.com
To: sam-fans@hawkwind.utcs.toronto.edu (Sam mailing list)
Subject: 9menu and sam
Date: Tue, 21 Feb 1995 14:08:25 -0500	[thread overview]
Message-ID: <9502211852.AA17856@cheetah> (raw)

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.

Beirne
----------------------------------------------------------------------

#!/usr/local/perl

($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'},
	"exit"	
----------------------------------------------------------------------

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



                 reply	other threads:[~1995-02-21 19:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9502211852.AA17856@cheetah \
    --to=hc05@summitis.com \
    --cc=sam-fans@hawkwind.utcs.toronto.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).