zsh-users
 help / color / mirror / code / Atom feed
* Command Utility Belt
@ 2006-01-19 19:37 Chris Johnson
  2006-01-20  2:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Johnson @ 2006-01-19 19:37 UTC (permalink / raw)
  To: zsh-users

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


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

end of thread, other threads:[~2006-01-20  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-19 19:37 Command Utility Belt Chris Johnson
2006-01-20  2:11 ` 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).