How does the matcher-list arguments work in zsh zstyle completion?

与世无争的帅哥 提交于 2019-12-21 04:28:22

问题


I'm trying to configure my ~/.zshrc so code completion on files/dirs work as I need it. I've found various ressources online on the zstyle completion syntax, and code example but some parts of it are still black magic to me.

So far, here is where I am, after some fiddling and testing :

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*'

Here is what I understand from it :

  • zstyle ':completion:*' means we are going to define a config value for completion
  • matcher-list is the config we update, here it defines how zsh match files/dir to suggest
  • 'm:{a-zA-Z}={A-Za-z}' 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*' are the arguments (values) to pass to the matcher-list config.
  • Here I have two arguments, separated by a space. It means zsh will first try to find files that match the first arg, and if it found nothing will try files that match the second arg

And here it becomes fuzzy :

  • I get that 'm:{a-zA-Z}={A-Za-z}' make the match case insensitive but I do not quite understand the syntax.
  • I also get that 'm:{a-zA-Z}={A-Za-z} l:|=* r:|=*' still is case insensitive, but also search for the match in the whole string, not just the start. But, I don't get the syntax either.

Can someone confirm my previous assertions, and correct them if needed, as well as detail the voodoo syntax of the arguments ?

Thanks

Edit : Oh, and sorry if the question is more fitted to superuser.com, I had a hard figuring which site was better suited for it.


回答1:


Hi the zsh doc for this is at

http://zsh.sourceforge.net/Doc/Release/Completion-Widgets.html#Completion-Matching-Control



来源:https://stackoverflow.com/questions/7906078/how-does-the-matcher-list-arguments-work-in-zsh-zstyle-completion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!