From: Chris Johnson <cjohnson@cs.utk.edu>
To: zsh-users@sunsite.dk
Subject: Command Utility Belt
Date: Thu, 19 Jan 2006 14:37:21 -0500 [thread overview]
Message-ID: <20060119193721.GA8560@namib.cs.utk.edu> (raw)
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@cs.utk.edu
http://www.cs.utk.edu/~cjohnson
next reply other threads:[~2006-01-19 19:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 19:37 Chris Johnson [this message]
2006-01-20 2:11 ` Bart Schaefer
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=20060119193721.GA8560@namib.cs.utk.edu \
--to=cjohnson@cs.utk.edu \
--cc=zsh-users@sunsite.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).