Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: command-cancellation with #



Micah Elliott sent me the following 1.3K:

> On 2007-12-20 Mikael Magnusson wrote:
> 
> > On 20/12/2007, Micah Elliott <mde@xxxxxxxxxxxxxxxx> wrote:
> > >     $ #ls foo
> > >     zsh: bad pattern: #ls
> > >
> > > Is there a way to make this work in zsh the way it does in bash?
> > 
> > setopt interactivecomments
> 
> Great, that works.  Thanks!
> 
> Is there some way I could have discovered that?  I don't see it
> in zshall(1).  I do see that it (and a few others) are set now by
> running 'setopt', but it would be nice to know what all the
> available options are (which aren't in the manpage).

It's in my zshall, and more narrowly, in zshoptions.

For the functionality of "pausing" a command line, you can also bind the
push-line widget (check out the zshzle man page for key binding and
line-editing options) to temporarily interrupt a command so as to
execute another, and have the interrupted command return for editing
automatically.  I bind this to Alt-Q (or Escape-Q):

   bindkey "^[Q" push-line

And I have this custom widget to help me store a command line in history
without executing it:

   commit-to-history() {
      print -s ${(z)BUFFER}
      zle send-break
   }
   zle -N commit-to-history
   bindkey "^X^H" commit-to-history

So, I type a command, hit Ctrl-X Ctrl-H, and then retrieve my command
from history when I need it.

-- 
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson



Messages sorted by: Reverse Date, Date, Thread, Author