From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11476 invoked by alias); 11 Nov 2014 21:41: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: 19367 Received: (qmail 22971 invoked from network); 11 Nov 2014 21:41:12 -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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Jan Larres Subject: Re: How to add a 'non-escaped' tilde to the completion list Date: Wed, 12 Nov 2014 10:40:54 +1300 Message-ID: References: <1415617649.1260.4.camel@gmail.com> <20141110113136.34766361@pwslap01u.europe.root.pri> <20141110121802.6f9434c4@pwslap01u.europe.root.pri> <1415625666.1260.8.camel@gmail.com> <15435.1415627852@thecus.kiddle.eu> <1415633542.1260.10.camel@gmail.com> <17517.1415653425@thecus.kiddle.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: yass.opencloud.co.nz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: <17517.1415653425@thecus.kiddle.eu> On 11/11/14 10:03, Oliver Kiddle wrote: > #autoload > > local -a expl > local -au dirs > > # undo work _main_complete did to remove the tilde > PREFIX="$IPREFIX$PREFIX" > IPREFIX= > SUFFIX="$SUFFIX$ISUFFIX" > ISUFFIX= > > [[ -o magicequalsubst ]] && compset -P '*=' > > case $OSTYPE in > solaris*) dirs=( ${(M)${${(f)"$(pgrep -U $UID -x zsh|xargs pwdx)"}:#$$:*}%%/*} ) ;; > linux*) dirs=( /proc/${^$(pidof zsh):#$$}/cwd(N:A) ) ;; > esac > dirs=( ${(D)dirs} ) > > compstate[pattern_match]='*' > _wanted directories expl 'current directory from other shell' \ > compadd -M "r:|/=* r:|=*" -f -a dirs I would suggest this addition to the function: dirs=( ${dirs//\/proc\/*\/cwd/} ) This removes unexpanded directories from the list. This can happen when a shell's directory has been removed, which pretty regularly is the case for me with auto-generated build directories. -Jan