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

Re: Case-insensitive completion



Bart wrote:

> Normally the way to do that would be to use different keybindings for
> "complete case-insensitively" vs. "complete case-sensitively" and tell
> zsh your preference by which of them you invoke.
> 
> Start with zstyles something like this:
> 
>   zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
>   zstyle ':completion:*:case-sensitive:*' matcher-list ''
>   zstyle ':completion:*' completer _expand _complete _ignored
> 
> Then, in a file (name doesn't matter much) somewhere in the path where
> compinit looks for completion functions, you put:
> 
> ---- 8< ---- snip ---- 8< ----
> #compdef -k complete-word \C-xI
> _main_complete _expand _complete:case-sensitive _ignored
> ---- 8< ---- snip ---- 8< ----

Would always use _generic for that type of thing myself. Avoids the need
for a separate function file:

zle -C case-sensitive complete-word _generic
zstyle ':completion:case-sensitive::::' completer _expand _complete _ignored
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:case-sensitive:*' matcher-list ''
bindkey '^XI' case-sensitive

Oliver



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