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

Re: New to zsh: zle, regular expressions conditionals, printf, history across shells (Mac OS X, zsh-4.2.7)

2008/12/5 Webb Sprague <webb.sprague@xxxxxxxxx>:
> Just discovered zsh!  Awesome!
> Here is are the first of many silly questions:
> 1.  Is there a place where I can read some zle examples?  I want to
> try to push some edits onto the buffer stack, but I can't figure out
> how...  if I run % zle at the command line, I get a return code of 1
> (bad, I think).  Also, if I run setopt, I get

The zle builtin command can only be used from bound widgets. Maybe you
want print -z?

> 2.  Is there a way to test regular expressions in [[ ]]?  Bash
> introduced a "=~" notation recently, and I was wondering if there is
> an equivalent thing.  Maybe globbing is as powerful as RE's, but I
> would still like to be able to do [[ $x =~ '^header: ' ]] or some
> such.

Yes, =~

> 3.  I can't figure out printf (or 'print -f').  If I type % printf
> "foobar" without any newline, the output disappears.  If I type %
> printf 'foo: %s\n' bar, I get "[m' bar:~foo: bar" -- I don't
> understand why the special characters, nor where to look to find out
> about them.

No idea here.

> 4.  Finally, is there a way to share my history across open shells?

setopt sharehistory histappend
should probably do it

Mikael Magnusson

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