Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: commandline "macro"
- X-seq: zsh-users 3074
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Eric Smith <eric@xxxxxxxxxxxx>, zsh users <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: commandline "macro"
- Date: Mon, 22 May 2000 00:45:05 +0000
- In-reply-to: <20000522010726.A3301@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <20000522010726.A3301@xxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author