Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Command Utility Belt
- X-seq: zsh-users 9840
- From: Chris Johnson <cjohnson@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Command Utility Belt
- Date: Thu, 19 Jan 2006 14:37:21 -0500
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
I'm finding that I have a lot of semi-often used commands that aren't
exactly appropriate for aliasing -- they need minor editing each time I
call on them. Furthermore, they're cryptic enough that it would be nice
to able to recall these commands easily (for editing). I wonder if
anyone knows a good solution.
Two ideas I've had work okay. The first is to assign the command to an
alias that does 'print -z' on the command. For example:
alias my_command='print -z prog arg1 arg2 arg3 ...'
The drawback to this is that it introduces a superfluous accept-line.
The second is to assign the plain old command to an alias and bind a key
to _expand_alias. This will of course expand the alias and keep the
line active for editing. The drawback to this one is that I have to
have the cursor on the alias itself to expand it. I've fashioned a
widget to allow arbitrary alias expansion:
expand-alias() {
zle beginning-of-line
zle vi-forward-char
zle _expand_alias
}
zle -N expand-alias
A third solution, which I might prefer but haven't yet attempted, is to
prime the history with these commands. I think 'print -s' would do
this.
Has anyone else implemented such a "command utility belt" and have
recommendations? Thanks!
--
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author