From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5314 invoked by alias); 10 Nov 2014 13:21:14 -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: 19361 Received: (qmail 18339 invoked from network); 10 Nov 2014 13:21:11 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:in-reply-to:references:content-type :mime-version:content-transfer-encoding; bh=8MjrGHDYeIHgL6ryq3wIAZaFd5lkwS+Tf8l5kGs5KE4=; b=fwFajgkgNK6kRg2eACW9vwkkLYv4zfT6px9CohEVSu6CeQ/RrVxDM1WSoWeLIZEywC FtMkZ3L28Bdo7Oc+S0eMDhKtWEPCrbPISFbCeXitukx4JzZQmGnZlOi+Bg84oN9NSLH+ mTrZg5f7uazrJl4MZcBDsVHzNrKZno1T+nk82dF3npBMnxEJigHvK6a9cAqfmdmATPrl k6e8WWLSrwqRHbFudGWfRydLn0GarKVNk/FwrlkNl6qqJfBDjVAoKf2SaiQack+0JQCr IhF1vhAjKJG6lg8uNYKPdXR9ARCUNe0MzFgqgv+KHs8x0DOgPDF615NS1aK7qz5MikVk 1YXA== X-Received: by 10.180.19.164 with SMTP id g4mr30210608wie.51.1415625669687; Mon, 10 Nov 2014 05:21:09 -0800 (PST) Message-ID: <1415625666.1260.8.camel@gmail.com> Subject: Re: How to add a 'non-escaped' tilde to the completion list From: Death Jester To: zsh-users@zsh.org Date: Mon, 10 Nov 2014 14:21:06 +0100 In-Reply-To: <20141110121802.6f9434c4@pwslap01u.europe.root.pri> References: <1415617649.1260.4.camel@gmail.com> <20141110113136.34766361@pwslap01u.europe.root.pri> <20141110121802.6f9434c4@pwslap01u.europe.root.pri> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.7-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Hi. ok. I thought it works and the substitution now actually works as intended, either with '-f' or '-Q'. But now I have another issue xD When I hit my shortcut 'CTRL+v', the completion system adds a '~' character to the command line instead of showing me the list of available directories. When I hit 'CTRL+v' again, I get an other '~' and the list. So now it looks like: cd ~~ ~/foler1 ~/folder2 and when I select a folder from the list, I have now '~~/folder2' on the commandline. How do I get rid of the first tilde? The code now looks like: function _term_list(){ local -a w for SESSION in $(pidof zsh); do PA=$(readlink -n /proc/${SESSION}/cwd) w+=(${(D)PA}) done compadd -af w } zle -C term_list complete-word _generic bindkey "^v" term_list zstyle ':completion:term_list:*' completer _term_list Thank you again. Cheers, Jester On Mon, 2014-11-10 at 12:18 +0000, Peter Stephenson wrote: > On Mon, 10 Nov 2014 11:31:36 +0000 > Peter Stephenson wrote: > > > > > But unfortunately the > > > line '${HOME}*) w+=$(echo ${PA} | sed s"|${HOME}|~|") ;;' does not work > > > as intended. The tilde is always "escaped". So the output looks like: > > > \~ > > > \~/folder > > > > > > How can I remove the backslash. > > > > I presume you mean it's escaped when it's inserted on the command line. > > > > The short answer is you need to add the -Q flag to the compadd at the > > end of the function so that the name doesn't get quoted. > > Ah, it's coming back a bit... Try adding -f instead of -Q. That tells > the system it's a file name, and I think that's good enough that it > knows tildes are special. > > pws