Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion of filenames
On 2019-12-13 11:46 a.m., Bart Schaefer wrote:
It's more than my tiny brain can really understand Bart, however:
You've got one more issue, I think, based on your subsequent question:
Where is 'expand-or-complete' defined?
You shouldn't be using both expand-or-complete and the _expand
completer.
I was under the impression that the TAB key called expand-or-complete
and that this somehow
tweaked itself via the 'zstyle .....' lines.
If you invoke expand-or-complete, it's going to try to do
expansion on the word and if that succeeds it will never proceed into
attempting completion. To use _expand, you should be re-binding the
TAB key:
bindkey "^I" complete-word
Usually compinit will take care of this for you, but only if the
zstyle definitions appear in your .zshrc (et al) BEFORE you invoke
compinit. This is in the doc:
To initialize the system, the function compinit should be in a direc-
tory mentioned in the fpath parameter ... If completion styles (see
below) are set up to perform expansion as well as completion by
default, and the TAB key is bound to expand-or-complete, compinit will
rebind it to complete-word; this is necessary to use the correct form
of expansion.
Does any of this help with your situation?
All possible combinations of the above have not yet been tested, however
as I have it now:
zstyle ':completion:*' completer _files _expand _complete
#('_files' first as you suggest).
autoload -U compinit && compinit -d $ZSHBOOT/zcompdump
This had been *above* the 'styles', moving it below the 'styles' as you
indicate seems to have worked :-)
What is puzzling is that your previous help with my 'styles' was
effective even though 'autoload ...' was above it.
# This is the default for TAB:
#bindkey '^I' expand-or-complete
#bindkey '^I' complete word #(tried but didn't work
*apart* from the above and seems not needed anyway so TAB is default.
So, pending further advice or tinkerings, It is exactly as I want: empty
or partial command line is first completed with local files.
I guess this is a cultural issue -- if one is accustomed to the normal
function then you wouldn't want it any other way and this could
be a last remaining vestige of my DOS-think, but I can't imagine
completion working on anything other than files myself, seeing commands
pop up really bothers me.
Thanks again Bart.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author