From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: _path_files and completeinword
Date: Wed, 10 Mar 1999 10:44:29 +0100 (MET) [thread overview]
Message-ID: <199903100944.KAA16241@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 9 Mar 1999 19:28:05 +0300
Andrej Borsenkow wrote:
> cp /t/s/z/D/zi
> ^ cursor here (before `i')
> bor@itsrm2:~> cp /tools/src/zsh-3.1.5-pws-11/Doc/z<== cursor here; no `i'
> If I _now_ add `i' and do the same - I get zsh.texi
`_path_files' does the matching itself -- and sometimes things get too
hard for it.
To allow `-g ...' patterns, it has to append these patterns to the
string from the line and then use that to generate filenames. Now you
might say that with `-f', no pattern is really needed. If you change:
f) sopt="${sopt}f"
pats=("$pats[@]" '*')
;;
to
f) sopt="${sopt}f"
pats=("$pats[@]" '')
;;
and
if [[ -z "$gopt" ]]; then
sopt='-f'
pats=('*')
to
if [[ -z "$gopt" ]]; then
sopt='-f'
pats=('')
you get what you expected. The same could be done for `-/' (this is
left as an exercise to the reader). I don't want to produce a patch
for this, though, because if we change it, the behavior will differ
from the behavior you get with things like `-g "*.(tex|TEX)"'. Here
the `*' in the pattern makes in-word completion fail in the way you
described.
Maybe this is another entry to the list of things I suggested the
`compstyle' parameter for.
> (I'm comparing to ways of life - how can I replace globcomplete. Is it
> possible to have the second binding with explcit globcomplete set? Sven, I
> think, it belongs to compstate as well. In this way I could have the second
> bindings that sets compstate[glob] and calls standard completion.
I'm not fully sure that I understand what you mean here. If you would
like to know if it possible to get a second key binding using the
completion code, but with `globcomplete'-behavior turned on, this is
simple:
- First solution: add a function
_glob_complete() {
compstate[pattern_match]=yes
_main_complete
}
add a widget for it and bind that to a key. (Hey, you could get all
this automatically by adding a file `_glob_complete' with the first
line `#defkeycomp complete-word \C-xg' and the body above.)
- Second solution: modify your `_main_complete' by adding something
like
[[ $WIDGET = glob_complete ]] && compstate[pattern_match]=yes
at the top. Then define a widget
zle -C glob_complete complete-word _main_complete
and that should do the job, too.
> Actually,
> I think, _all_ options that modify completion belong to compstate. The quick
> workaround is to save globcomplete, and reset it before exit, sure).
That's part of the things we are working on. I once had the idea to
make `compstate' get keys with the names of the options, but then
decided against it because some of them have multiple effects and I
wanted to do this in a cleaner way. Setting/resetting options in
cmpletion widgets, btw, will only seldom have an effect on the post-
processing, exactly for the reason, that this is now controlled by
`compstate'.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-03-10 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-10 9:44 Sven Wischnowsky [this message]
1999-03-11 17:51 ` Andrej Borsenkow
-- strict thread matches above, loose matches on Subject: below --
1999-03-12 8:35 Sven Wischnowsky
1999-03-09 16:28 Andrej Borsenkow
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=199903100944.KAA16241@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/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).