9front - general discussion about 9front
 help / color / mirror / Atom feed
From: qwx@sciops.net
To: 9front@9front.org
Subject: Re: [9front] sam menu command patch
Date: Sat, 01 Jun 2024 14:30:15 +0200	[thread overview]
Message-ID: <276E414CB17EF600E7AD119C8CF3AF3A@wopr.sciops.net> (raw)
In-Reply-To: <7335757DA3222A181B6A8E6C78515DD2@prosimetrum.com>

On Sat Jun  1 13:43:46 +0200 2024, umbraticus@prosimetrum.com wrote:
> Others may find this useful; allows adding commands to sam's b2 menu.
> Rather than some kind of polling watch script, I prefer something like
> 	^echo w; window 'mk && 6.out'
> from within sam; this makes such workflows even more convenient.
> You can combine with ^mysaminit and load all your favourite
> commands into the menu on startup.

Fuck yes.  Let's merge it.

I don't think this mail alone does the patch justice.  Here are two
examples of a collection of samscripts one can preload:

http://runjimmyrunrunyoufuckerrun.com/rc/s
http://shithub.us/qwx/rc/HEAD/bin/s/f.html

To load these, you do ^s in sam, and they are now usable within it.
Check out the u script in either file: !u starts a new rio window
showing the description of these and their usage (from my own
script):

^r [cmd]     # run command in cwd and send output to jam.err window
^R [cmd]     # run command and send output to jam.err window
^T	# write to disk any modified files
!o name expr # save a sam command
^O expr      # run any rc function
^w [cmd]     # open window in cwd
^W [cmd]     # open window in current file's directory
^dump		# print all files in menu
!u [fn...]   # print sam fn usage
^+ [n]       # increase indent
^- [n]       # decrease indent
[etc.]

What this patch does is allow you in addition to add these to your mb2
mouse menu.  For example, my s script sources a file in my $home/lib
directory that looks like this:

cat <<!
M ^W
M ^-
M ^+
M ^T
M ^r D
M ^r mk install
M ^r mk clean
M |fmt -l 82
M ^r mk coarsen.install
M ^R ass
!
fn dicks {
	for(i in 01 02 03 04 05 06 07 08 09 10 11 12) mk testct^$i^.install
}

Then I can open the mouse menu and select ^T to write all open files,
or select a line of text and do ^+ to indent it, or run ^r mk install
to rebuild what I have in the current directory, or ^R d to open a
vdiff in the directory the current file is in, or !fmt -l 80 over the
selection, or run some command I've been using a lot, or [etc.]

It's just examples.  You can select something in the command window,
type M and 'send' it, and you have a menu item to re-run it at
moment's notice.  You delete menu items by just issuing the same M
command as before.  It's incredibly effective, I love it and I vouch
for it 1000%.

Thanks,
qwx

      reply	other threads:[~2024-06-01 12:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-01 11:44 umbraticus
2024-06-01 12:30 ` qwx [this message]

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=276E414CB17EF600E7AD119C8CF3AF3A@wopr.sciops.net \
    --to=qwx@sciops.net \
    --cc=9front@9front.org \
    /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).