zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Cc: Allomorphy <allomorphy@gmail.com>
Subject: Re: creating a mnemonic for a history command
Date: Fri, 17 May 2024 20:11:27 -0700	[thread overview]
Message-ID: <CAH+w=7ajwVj7YPDFj552CAT1TnDimQeUmmSd5abSd+0LbwANJg@mail.gmail.com> (raw)
In-Reply-To: <672456907.1840983.1715954446011@mail.virginmedia.com>

On Fri, May 17, 2024 at 7:01 AM Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> > On 17/05/2024 12:03 BST Allomorphy <allomorphy@gmail.com> wrote:
> > This is one of the most useful incantations for me:
> > !?foo?:%
> >
> > What is an elegant way to set up a mnemonic like say an alias or
> > something else to type
>
> Your best bet is probably to use an editor function [...]
>
> gimme() {
>   LBUFFER='!?'$LBUFFER
>   RBUFFER='?:%'$RBUFFER
>   zle accept-line
> }

This widget not only retrieves the word, but executes it as a command,
which it seems to me unlikely to be the intended effect?  I wonder if
the OP would prefer e.g. complete-word instead of accept-line?

Or perhaps (assuming compinit has run) just escape-slash to invoke
_history-complete-older, if that works well enough?


      reply	other threads:[~2024-05-18  3:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17 11:03 Allomorphy
2024-05-17 14:00 ` Peter Stephenson
2024-05-18  3:11   ` Bart Schaefer [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='CAH+w=7ajwVj7YPDFj552CAT1TnDimQeUmmSd5abSd+0LbwANJg@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=allomorphy@gmail.com \
    --cc=zsh-users@zsh.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).