From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20589 invoked by alias); 25 Dec 2013 06:59:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18252 Received: (qmail 24303 invoked from network); 25 Dec 2013 06:59:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131224225937.ZM766@torch.brasslantern.com> Date: Tue, 24 Dec 2013 22:59:37 -0800 In-reply-to: Comments: In reply to "Yuri D'Elia" "Re: Expanding quotes" (Dec 24, 5:11pm) References: <131217102648.ZM8656@torch.brasslantern.com> <131223111515.ZM31989@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Expanding quotes MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 24, 5:11pm, Yuri D'Elia wrote: } } Personally, I would actually prefer is there was an option in zsh to } normalize the quoting mechanism to always "double quote" the argument } instead of escaping characters (thus inserting the initial double-quote } if missing). I don't know if this would actually simplify or furthermore } complicate the expansion rules. Have a look at Functions/Zle/quote-and-complete-word in the distributed sample functions. } the fact that a glob might not expand in the same way as when executed } makes a bit of uneasy feeling for me. I often use expansion to } proof-check a glob instead of executing the command twice. } } Maybe there's a better way to do it that doesn't involve running "ls } glob" before "real-command glob". You can create your own little completer that does nothing but globbing: _glob () { local -a globbed globbed=( ${(Q)~words[CURRENT]} ) [[ $globbed == $words[CURRENT]] ]] && return 1 compadd -Uf -a globbed } You can fiddle with the assignment to globbed until you get the behavior you want. What I've done with ${(Q)~words[CURRENT]} may not be to your liking; e.g. you might prefer ${~words[CURRENT]//\\/} to only remove any backslashes. Something of the kind is needed, though, because the tilde operator only makes globbing characters active, it doesn't unquote other special characters that may be quoted in the value of $words. The default completers if you don't set a style are (_complete _ignored). So you just need to add yours: zstyle ':completion:*' completer _glob _complete _ignored (Use "zstlyle -L" to see if you've already changed the completer style, and if so just add _glob in an appropriate place.)