From: Jan Larres <jan@majutsushi.net>
To: zsh-users@zsh.org
Subject: Re: How to add a 'non-escaped' tilde to the completion list
Date: Wed, 12 Nov 2014 10:40:54 +1300 [thread overview]
Message-ID: <m3tvp7$flc$1@ger.gmane.org> (raw)
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
next prev parent reply other threads:[~2014-11-11 21:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 11:07 Death Jester
2014-11-10 11:31 ` Peter Stephenson
2014-11-10 12:18 ` Peter Stephenson
2014-11-10 13:21 ` Death Jester
2014-11-10 13:42 ` Peter Stephenson
2014-11-10 13:57 ` Oliver Kiddle
2014-11-10 15:32 ` Death Jester
2014-11-10 21:03 ` Oliver Kiddle
2014-11-11 10:17 ` Death Jester
2014-11-11 21:40 ` Jan Larres [this message]
2014-11-10 12:54 ` Death Jester
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='m3tvp7$flc$1@ger.gmane.org' \
--to=jan@majutsushi.net \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).