zsh-users
 help / color / mirror / code / Atom feed
* commandline "macro"
@ 2000-05-21 23:07 Eric Smith
  2000-05-22  0:45 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Smith @ 2000-05-21 23:07 UTC (permalink / raw)
  To: zsh users

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.
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.

-- 
Eric Smith
also on 082 373 1224


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: commandline "macro"
  2000-05-21 23:07 commandline "macro" Eric Smith
@ 2000-05-22  0:45 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2000-05-22  0:45 UTC (permalink / raw)
  To: Eric Smith, zsh users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-05-22  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-21 23:07 commandline "macro" Eric Smith
2000-05-22  0:45 ` Bart Schaefer

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).