Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
re:[zash-3.0.0] bug in cdmatch for dirs w/ embedded space?
- X-seq: zsh-workers 2137
- From: "alain (a.) caron" <alainc@xxxxxxxxx>
- To: mdb@xxxxxxxxxxxx
- Subject: re:[zash-3.0.0] bug in cdmatch for dirs w/ embedded space?
- Date: Thu, 12 Sep 1996 15:38:00 -0400
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- Sender: "alain (a.) caron" <alainc@xxxxxxxxx>
- X400-content-type: P2-1984 (2)
- X400-mts-identifier: [/PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/;bcars735.b.901:12.08.96.22.01.17]
- X400-originator: /dd.id=1569151/g=alain/i=a/s=caron/@bnr.ca
- X400-received: by mta bnr.ca in /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Thu, 12 Sep 1996 22:39:45 -0400
- X400-received: by /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Thu, 12 Sep 1996 18:01:17 -0400
- X400-received: by /PRMD=BNR/ADMD=TELECOM.CANADA/C=CA/; Relayed; Thu, 12 Sep 1996 15:38:00 -0400
In message "[zash-3.0.0] bug in cdmatch for dirs w/ embedded space?",
'mdb@xxxxxxxxxxxx' writes:
>I'm trying to get zsh to complete a directory that has an embedded
>space, e.g., `foo bar' (personally I don't like them, but with
>mac/win95 filenames it seems to be pretty common to come across).
>
>I used the versions of compctl, cdmatch, and cdmatch2 distributed with
>zsh-3.0.0, and invoked zsh with the -f switch. It fails because too
>many backslashes get put in the completion, e.g.,
>
> % cd foo<TAB>
>results in
> % cd foo\\\ bar/
>
>Is there a more up to date cdmatch/compctl for this sort of thing? Or
>is there a (non-default) that needs to be set?
>
>Thanks.
>
>Here's exactly what I did:
>
>charney$ ~/bin/sunos-5.5/zsh-3.0.0 -f
>charney% echo $ZSH_VERSION
>3.0.0
>charney% ls
>foo bar
>charney% if [[ -o AUTO_REMOVE_SLASH ]] then
>then> compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>then> -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -q -S '/' -- cd pushd
>then> else
>else> compctl -x 'p[2]' -Q -K cdmatch2 - 'S[/][~][./][../]' -g '*(-/)' + \
>else> -g '*(-/D)' - 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
>else> fi
>charney% fpath=(~/.zfunctions)
>charney% autoload cdmatch
>charney% autoload cdmatch2
>charney% cd foo\\\ bar/ # typed cd foo<TAB> here
>cd: no such file or directory: foo\ bar/
>charney% cd foo\ bar
>charney% pwd
>/tmp/mdb/foo bar
>charney% cat ~/.zfunctions/cdmatch
># Start of cdmatch.
># Save in your functions directory and autoload, then do
># compctl -x 'S[/][~][./][../]' -g '*(-/)' - \
># 'n[-1,/], s[]' -K cdmatch -S '/' -- cd pushd
>#
># Completes directories for cd, pushd, ... anything which knows about cdpath.
># You do not have to include `.' in your cdpath.
>#
># It works properly only if $ZSH_VERSION > 2.6-beta2. For erarlier versions
># it still works if RC_EXPAND_PARAM is not set or when cdpath is empty.
>local narg pref cdp
>read -nc narg
>read -Ac pref
>cdp=(. $cdpath)
>reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t:gs/ /\\\\ /) )
replace this last line by:
reply=( ${^cdp}/${pref[$narg]%$2}*$2(-/DN^M:t) )
and everything should work fine. At least, it does for me.
>return
># End of cdmatch.
>charney% cat ~/.zfunctions/cdmatch2
># This function should be called from compctl to complete the
># second argument of cd and pushd.
>local from
>read -Ac from
>from="${from[2]}"
>eval "reply=( \${PWD:s@$from@$1*$2@}~$PWD(ND-/:) )"
>reply=( "${${reply[@]#${PWD%%$from*}}%${PWD#*$from}}" )
>[[ ${#reply[(r),-1]} != 0 ]] && reply[(r)]="''"
>return
>charney%
>charney$
>
>--
> -mb-
>
Regards,
Alain Caron
Nortel Technology, Montr?al, Qu?bec, Canada
email: alainc@xxxxxxxxx
phone: 514-765-7718 or ESN 852-7718
Messages sorted by:
Reverse Date,
Date,
Thread,
Author