Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Playing with list-expand + complete-word



On Jul 19,  2:22am, Silas Silva wrote:
}
} I always wanted to change default behaviour of zsh expand and completion
} behaviour to something similar to ksh or bash, that is:
} 
}     % ls *<tab>
} 
} After pressing tab, in expand-or-complete widget would expand * to every
} file in current directory.  In ksh it would just print a list of files
} that match the glob.

Since you've read chapter 6 of the user guide and fiddled with styles,
I presume you have run compinit, and have also bound TAB to complete-word
instead of expand-or-complete?

Whether or not you've run compinit,

    bindkey $'\t' complete-word
    setopt glob_complete

will probably get you very close to the behavior you want.  How it works
out in combination with the zstyle settings you've experimented with, I
can't say.

Equivalently (if you *have* run compinit), you should be able to add
_match to your list of completers, e.g.

    zstyle ':completion:*' completer _complete _match

If glob_complete doesn't seem to be what you want ...

} ... the solution I found was to create a new widget with the
} following line:
} 
}     zle list-expand || zle complete-word
} 
} It worked really fine until I realized the problem with variables and
} tildes.  So, the following:
} 
}     % cd ~/<Tab>
} 
} Will not list directories in $HOME, but just give a list ofone item:
} /home/username.  The same happens if I change ~ by $HOME variable.

What you probably want there is

    zle list-choices || zle list-expand || zle complete-word

However ...

} I'd like that it ignored the expansion of tilde and variables if there
} was slash.  Any clue?

You've just described the behavior of the _expand completer when the
"suffix" zstyle is true (the default).  What's the current value of
your "completer" zstyle?



Messages sorted by: Reverse Date, Date, Thread, Author