is it possible that zsh complete the whole file name from partial words of correct filename ? For example, there are (helloABC, helloabc, helloworld) under this folder, and I want to type only (oab + tab) to get (helloABC, helloabc.)
Yes this is possible. It can be enabled in the zsh completion system.
Adding these lines to your .zshrc
will give you this feature:
zstyle ':completion:*' completer _complete
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
autoload -Uz compinit
compinit
_completer
gives normal completion behaviour
'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+l:|=* r:|=*'
takes care of case-insensive matching and that matching may occur on both sides of the current word (that is matching from the middle part of a filename).
Note: Some of these or similar lines may already be in your ~/.zshrc
. In that case you may have to edit them:
if not already there _complete
has to be added to the line starting with the definition for completer
If already present the rule for case-insensitivity might look different, for example m:{A-Za-z}={a-zA-Z}
, which you can either be replaced or left as is.
+l:|=* r:|=*
has to come immediatelly after the rule for case-insensitivity (it may also work if there are only rules starting with +
between those two rules, but I did only check some basic combinations, which worked)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With