Zsh Mailing List Archive
Messages sorted by:
Re: Another keep-prefix problem
- X-seq: zsh-workers 14083
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>, Zsh Workers <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: Another keep-prefix problem
- Date: Tue, 24 Apr 2001 16:50:25 +0000
- In-reply-to: <Pine.LNX.4.30.0104231732080.26875-100000@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <Pine.LNX.4.30.0104231732080.26875-100000@xxxxxxxxxxxxxxx>
On Apr 23, 5:46pm, Wayne Davison wrote:
} Subject: Another keep-prefix problem
} I noticed one other problem with the current zsh (in CVS) and how it
} handles keeping the prefix. After Bart's last set of tweaks, this
} % ls $var1/foo/$var2/bar<TAB>
} But leaving off the leading variable results in a useless expansion:
} % ls /full/path/foo/$var/bar<TAB>
} When the filename only has an embedded variable, it is expanded.
I suspect this is because of the `suffix' style:
This is used by the _expand completer if the word starts with a
tilde or parameter expansion. If it is set to `true', the word will
only be expanded if it doesn't have a suffix, i.e. if it is
something like `~foo' or `$foo', but not if it is `~foo/' or
`$foo/bar', unless that suffix itself contains characters eligible
for expansion. The default for this style is `true'.
In your example, $var2 is in the suffix and eligible for expansion, so
expansion is tried, and keep-prefix only preserves the leading $var1 in
} Here's a (completely usless) failure case:
} zsh -f
} % autoload -U compinit
} % compinit
} % zstyle ':completion:*' completer _expand _complete
} % zstyle ':completion:*:expand:*' keep-prefix true
} % bindkey '\t' complete-word
} % www=/var/www/html
} % mkdir $www/subdir
} % echo ~
} % ls -l ~/../..$www/sub<TAB>
} ... properly expands to 'subdir' ...
You don't mean "expands", you mean "completes", right?
} % ls -l /home/wayne/../..$www/sub<TAB>
} ... does not.
Exactly how does it not work? For me, it expands (not completes) to
`/home/wayne/../../var/www/html/sub' and completion can continue from
there. keep-prefix only applies to words that begin with `~' or `$',
not to words that have a `$' anywhere in the prefix; the `suffix' style
is for the words with a `$' somewhere else (which is a slight misnomer,
as it means the file-path-suffix of the completion-prefix, and not the
completion-suffix (which is the stuff to the right of the cursor)).
Maybe you want to look at the `subst-globs-only' and/or `substitute'
styles, if you haven't already done so.
Bart Schaefer Brass Lantern Enterprises
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by: