Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: History in Non-Interactive Shells
- X-seq: zsh-users 11048
- From: Achille <achille.listserv@xxxxxxxxx>
- To: "Chris Johnson" <cjohnson@xxxxxxxxxx>
- Subject: Re: History in Non-Interactive Shells
- Date: Tue, 28 Nov 2006 13:30:28 -0500
- Cc: zsh-users@xxxxxxxxxx
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=lx5ZvEbKsT3n0asAJCRiNGQK3BiaO/rxX5fewqCWF/9XfSa/9zTm7+5CGYPVUcS3iqhTvIbH2iUFUJrSQ5NVfOu5d7GzsA5/rPcQg2f+Govct+ta79DTLNu6VlxFxjNa0QEXQIdbLKFYm4mdgaa3+fh7W3x2F1fCIhvg2ReeI10=
- In-reply-to: <20061128172105.GA24129@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061128172105.GA24129@xxxxxxxxxxxxxxxxx>
I'm not sure if it's exists but you could try this hack
preexec() { LASTCMD=$THISCMD; THISCMD=$1 }
Then make use of the $LASTCMD env variable from within vi.
On 11/28/06,
Chris Johnson <cjohnson@xxxxxxxxxx> wrote:
Is there any mechanism in zsh for accessing history in non-interactive
shells? An application I see for such a mechanism is in invoking the
shell from within an application when I only know a bit of the command.
For instance, when editing in vim a source file myapp.c that creates an
application myapp, it'd be great to be able to call the executable
without closing vim and instead calling ":!myapp" to find the last call
to myapp with the appropriate arguments. (I already make the executable
without closing vim.)
I could probably conjure up something by reversing the history file in
sed and grep'ing the result for the root name of the source file.
Either operation is probably a little expensive, but I thought I'd
check.
--
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author