Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to add a 'non-escaped' tilde to the completion list
- X-seq: zsh-users 19361
- From: Death Jester <d3ath.jest3r@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to add a 'non-escaped' tilde to the completion list
- Date: Mon, 10 Nov 2014 14:21:06 +0100
- 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==
- In-reply-to: <20141110121802.6f9434c4@pwslap01u.europe.root.pri>
- 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: <1415617649.1260.4.camel@gmail.com> <20141110113136.34766361@pwslap01u.europe.root.pri> <20141110121802.6f9434c4@pwslap01u.europe.root.pri>
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 <p.stephenson@xxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author