zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Tomasz Pala <gotar@polanet.pl>
Cc: zsh-users@zsh.org
Subject: Re: zle - keep state of the buffer on accept-and-hold or hold only part
Date: Tue, 28 Jul 2020 11:48:23 +0000	[thread overview]
Message-ID: <20200728114823.015cd568@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20200728103038.GA7887@polanet.pl>

Tomasz Pala wrote on Tue, 28 Jul 2020 12:30 +0200:
> My usage scenario follows - consider having (not so) many files with similar
> names, like date/counter-suffixed. I need to perform some operations on them,
> one by one (the commands slightly differ, assume it's not scriptable
> worthy), e.g.
> 
> [1] xsltproc style.xslt file_200701.xml [alt-a: accept-and-hold]
> [2] xsltproc style.xslt file_200701.xml | grep -v some_spam [accept-and-hold]
> [3] xsltproc style.xslt file_200701.xml | grep -i sth_interesting | actual command [accept-and-hold]
> 
> [1] xsltproc style.xslt file_200702.xml [accept-and-hold]
> [2] xsltproc style.xslt file_200702.xml | grep -v something_other [...]
> 
> 
> Now, I got the " | grep -i sth_interesting | actual command" in xterm
> PRIMARY and insert it fast with alt-shift-insert - so the [3] line is
> fine. The [2] line changes depending on xsltproc output, it's written
> ad-hoc, no optimization can be made.
> 
> 
> However, most of the time I'm wasting is on going back to the point:
> 
> xsltproc style.xslt file_2007 <- here.
> 
> I can set a mark (ctrl-space) and then kill entire region, but the mark
> doesn't propagate to the buffer after accept-and-hold.
> 

As a workaround, you might try changing your command to one of these:

% { xsltproc style.xslt - | grep … } <file_200701.xml
% <file_200701.xml xsltproc style.xslt - | grep …
% () { xsltproc style.xslt "$@" | grep … } file_200701.xml

This should make it easier to edit the filename, because it'll be at
the start or end of the command line.

Regarding your other points, I'll defer to others.

Cheers,

Daniel

      reply	other threads:[~2020-07-28 11:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 10:30 Tomasz Pala
2020-07-28 11:48 ` Daniel Shahaf [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=20200728114823.015cd568@tarpaulin.shahaf.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=gotar@polanet.pl \
    --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).