bat icon indicating copy to clipboard operation
bat copied to clipboard

case insensitive filename completion not working in zsh

Open kerma opened this issue 2 years ago • 3 comments

When typing bat r<tab> no completion happens for files starting with capital R.

The problem in the case statement after the _arguments call in _bat_main https://github.com/sharkdp/bat/blob/9ab378b5dc7fa7835a27a641e51b5c362bf3bb00/assets/completions/bat.zsh.in#L58-L61

Can be "fixed" with disabling the case statement. But I don't know how to fix it properly to keep completion working for language, theme, style.

Maybe it's an intended behavior. In that case the issue report hopefully helps someone else with a workaround.

kerma avatar Mar 18 '22 13:03 kerma

Maybe @Kienyew or @xzfc can help here? (if you are interested)

sharkdp avatar May 22 '22 10:05 sharkdp

@kerma The completion of filename is provided by zsh's own directive _files (line 55). Can you provide a brief example directory structure which the problem occurs, because I couldn't reproduce that problem. Maybe we falled into some edge case?

https://github.com/sharkdp/bat/blob/9ab378b5dc7fa7835a27a641e51b5c362bf3bb00/assets/completions/bat.zsh.in#L55-L61


I'm not quite sure is this problem configuration dependent? Maybe we can haev a look on this: https://stackoverflow.com/questions/24226685/have-zsh-return-case-insensitive-auto-complete-matches-but-prefer-exact-matches

Kienyew avatar May 22 '22 10:05 Kienyew

I changed '*: :_files' to '*:-:_files -g "*(.)"' and tab completion for files started working for me.

genevera avatar May 03 '24 18:05 genevera