From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: trivial problem with histverify
Date: Mon, 01 Dec 2014 18:47:01 -0800 [thread overview]
Message-ID: <141201184701.ZM30368@torch.brasslantern.com> (raw)
In-Reply-To: <547D0369.3060802@eastlink.ca>
On Dec 1, 4:10pm, Ray Andrews wrote:
}
} I'm guessing that the code that handles 'histverify' sees the " !! "
} and so demands the ENTER, but I'd say that in this situation
You're misinterpreting histverify.
It is not intended to verify that "a history command is actually being
executed." It is intended to verify that in the text of any command in
which history was referenced, the correct history reference was made.
For example, suppose you typed
% rm -f !:4
(remove the file named by the fourth argument of the previous command).
Histverify allows you to see which file name is going to be removed
before it actually is removed.
} shouldn't be required since no history command is actually being
} executed, it's just a listing of string matches.
You're giving the shell way too much credit for "knowing" what the
effects of the command are going to be. You might have a command in
$HOME/bin named "grep" for "gamma radiation exposure percentage" or
"get rid of everyone please."
} wondering if there's a workaround, so that my binding is exempt
Don't use "!!" in the binding?
Honestly, how did it ever get that complicated? Why print -s the words
into the history and then pull them back out again with "!!" rather
than just:
bindkey -s '\e[5~' '\C-a history 1 | grep "[[:digit:]] \C-e"\C-m'
?? Which of course breaks if there are any double quotes in what you
typed before pressing page-up, but that was already the case.
} BTBTW it seems a strange way to
} could find that worked at the time.
This is a case where you should be writing a user-defined widget rather
than using "bindkey -s".
grep-history() {
(( HISTNO > 1 )) || return
zle -I
history 1 | grep --color=auto "[[:digit:]] $BUFFER"
}
zle -N grep-history
bindkey '\e[5~' grep-history
Better?
next prev parent reply other threads:[~2014-12-03 2:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 20:20 Ray Andrews
2014-12-01 23:26 ` Mikael Magnusson
2014-12-02 0:10 ` Ray Andrews
2014-12-02 2:47 ` Bart Schaefer [this message]
2014-12-03 3:53 ` Ray Andrews
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=141201184701.ZM30368@torch.brasslantern.com \
--to=schaefer@brasslantern.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).