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

Re: making `cd` work unquoted



On Wed, 5 Aug 2009 17:14:03 +0200
Sebastian Stark <seb-zsh@xxxxxxxxxxx> wrote:

> You would also have to deal with the special case cd with two
> arguments:
> 
> Consider you are in /home/userA/tmp
> 
>    cd userA userB
> 
> would lead you to /home/userB/tmp

I tried this out, and it's interesting.  I didn't realise this was
possible.  I can't imagine why I'd want to do this though.

Well, it does look like I'd have to use my own custom keyword and not
try to replace cd.  These sorts of corner cases would be a disaster.  =)


> It's there already: quote-line and quote-region.

Sweet.

quote-line is already bound to meta-' and meta-", both generating
a single quote.  I'd think that meta-" should generate double-quotes,
but I don't really care.

quote-region looks like it can be leveraged to do all kinds of
interesting stuff.


> Especially the latter is useful together with set-mark-command,

That's not where I need to go to solve this current problem, but it's
certainly interesting stuff.


> which I have bound to ESC-v, just like in vim. In newer zsh version
> you even get different color for characters that are "marked" like
> this, e. g.:
> 
>    zle_highlight=(region:bg=red special:underline)

I tried this out briefly, but it didn't seem to work as-expected.  I'll
look at this more seriously when I do get into the set-mark-command
stuff.

--

I did make a basic hotkey which does the quoting I'm looking to do.
Initially searching for quote-region related code, I ended up
bumping into some other code which I could modify to do what I want.

This also happens to set the mark, but that doesn't bother me.

 bindkey -s '^X' '^@^[[1;5C^A\ef\e" ^@'

.. which does:

 audacious /some/path/~ music file ~.mp3
 =>
 audacious '/some/path/~ music file ~.mp3'



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