From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Eric Smith <eric@fruitcom.com>, zsh users <zsh-users@sunsite.auc.dk>
Subject: Re: commandline "macro"
Date: Mon, 22 May 2000 00:45:05 +0000 [thread overview]
Message-ID: <1000522004505.ZM11820@candle.brasslantern.com> (raw)
In-Reply-To: <20000522010726.A3301@fruitcom.com>
On May 22, 1:07am, Eric Smith wrote:
} Subject: commandline "macro"
}
} Is there a way to map to a key combination certain strings that then come
} up on the command line? You may then further edit whatever appears.
Look at "bindkey -s ...".
} Similiar to searching your history file and having a previous command
} come up but in this case the commands are stored in your rc file.
If you mean you want to have a set of keystrokes that lets you scroll
through a list of commands and choose one to edit, you're probably best
off making use of the new completion system in (soon-to-be) 3.1.7.
Something like this, which you name whatever you want and put into a
directory in $fpath so compinit will see it:
---- 8< ---- snip ---- 8< ----
#compdef -k menu-complete ^X:
local -a commands
commands=(${(f)"$(cat)"}) <<\EOF
echo Put any commands you like here,
echo as long as they don\'t need embedded newlines.
: 'This is a hack because a here-document does not work in $(...),'
: in fact it puts the parser into state from which it can never
: correctly return.
EOF
compadd -Q "$commands[@]"
---- 8< ---- snip ---- 8< ----
Now you can type ^X: and then TAB your way through the commands, or set
up styles to start menu-selection, or whatever.
It does beep a lot when I try it, for reasons I'm too heat-oppressed to
figure out just now (Sven?), but it works.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
prev parent reply other threads:[~2000-05-22 0:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-21 23:07 Eric Smith
2000-05-22 0:45 ` 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=1000522004505.ZM11820@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=eric@fruitcom.com \
--cc=zsh-users@sunsite.auc.dk \
/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).