Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Quoting the arguments to a function
- X-seq: zsh-users 21934
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Quoting the arguments to a function
- Date: Sat, 17 Sep 2016 06:24:56 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=aaTR7ExjWawuy7YC 8KU3naNwFOM=; b=stkVHrmYkxIW+GoZ7B8ox/RAv87yirAI4dM7ts6to9X7Apg/ 8FDi+209s2rAt8pZHHH3+4scia+oIcLJTA3H5g35JHEMzsBGvBY1gZN2laszfj65 t7qwzNUVLSCq7Ni0CVs9/I+5YejKI1jr2gomknUH9jrfHnlqHSnN0VIN/YY=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=aaTR7ExjWawuy7Y C8KU3naNwFOM=; b=eXv27dsLHkTqIP0Iek8wAX9Xt4jL71dud4URC4HbWW60M3T 8YAwe2EKXUsjfiAICXDwwo4fGsX98K9Rw2hTPdbsxfMFfztzbgHhqWPljKRio0GD NUGytL4eLUdnPECmke36jFiM00vEXVqCUfCeT0DmEBphtUPGYcqvEFANBTis=
- In-reply-to: <160916100934.ZM11263__9881.101063411$1474045859$gmane$org@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <nrf4he$u13$1@blaine.gmane.org> <20160916105230.GB3491@cventin.lip.ens-lyon.fr> <160916100934.ZM11263__9881.101063411$1474045859$gmane$org@torch.brasslantern.com>
Bart Schaefer wrote on Fri, Sep 16, 2016 at 10:09:34 -0700:
> The nice thing about url-quote-magic is that it can make all of its
> decisions based solely on examinination of the current word; if the
> beginning of the word looks like "schema:" (for various values of
> schema), then the rest of the word is subject to quoting.
>
> To do argument quoting based on the command context, one must either
> accept the naive solution of examining only the first word on the
> line, or do more detailed command-line analysis on the level of
> what's done by the completion system.
z-sy-h implements something like this to be able to highlight command
positions throughout $PREBUFFER and $BUFFER. Specifically, z-sy-h's
parser knows at any point what the last command word was and what are
the $BUFFER start and end offsets of the current shell word.
> It's also pretty easy to create a little widget to quote the current
> word:
>
> quote-this-word() { zle select-in-blank-word; zle quote-region }
> zle -N quote-this-word
> bindkey \'\' quote-this-word
>
> (That is, if I type single-quote twice in fairly rapid succession,
> quote the word the cursor is in or follows. Users of RC_QUOTES may
> want to use two double-quotes or some other combination.)
Even without RC_QUOTES, the binding «''» collides with the «'\''»
sequence for embedding a literal single quote in a single-quoted string.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author