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

Re: "Literal" command execution



On Mon, Jan 23, 2012 at 20:51, Yuri D'Elia <wavexx@xxxxxxxxxxxx> wrote:
> I'm trying to reduce some typing here, as usual ;).
> I have a command line logger that allows free text as its main arguments (random example: taskwarrior). A typical example might be:
>
>  command log [free text follows]
>
> I want to reduce escaping to the bare minimum. Dollars are not really a problem, but I discovered myself to escape '<' '>' and '!' too often.
>
> Of course I am already aware of both noglob and nocorrect, but I would need something more extreme, as in "feed whatever text, including #, etc, that follows the command as arguments".
>
> Is there any way to achieve that?
> Maybe by some rewriting trick?

Hello,

For URLs I'm using something called url-quote-magic: when I start
writing an URL, it's detected and then all special characters are
escaped (&, <, >, !).
autoload -U url-quote-magic ; zle -N self-insert url-quote-magic
This is really great for copying+pasting URLs, for example to use it in wget.

What you want to do looks pretty similar, so maybe this could be a
starting point for you? (except it's during a specific command
arguments instead of autodetected)

Regards,

-- 
Damien Thebault



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