In Vim, one can combine the following commands, :set smartcase + :set ignorecase, to make searching case-insensitive unless there is a capitalized letter in the search query, in which case it is case-sensitive.

In bash, one can make auto-completion case-insensitive by adding set completion-ignore-case on into their ~/.inputrc.

Is there anyway to get the conditional case-sensitivity behavior similar to Vim's smartcase + ignorecase searching for bash auto-completion?

  • I think the first step is exec zsh and the second step is configuring this behavior on the new user setup interface (and the way it works is through the matcher-list style). – Gilles Jun 21 '16 at 23:17
  • Could you expand on that a bit? Not sure I follow... Are you suggesting to use calls to zsh when pressing tab to get the zsh-supported smartcase completion? – StrugglingProgrammer Jun 22 '16 at 17:45
  • No, I'm suggesting to ditch bash and use zsh instead. My first comment was wrong, I'd misread your request — what you can do through zsh's new user customization interface is to make completion case-sensitive, but fall back to case-insensitive if there's no match. This isn't what you wanted but may be good enough in practice. AFAIK what you want is doable in zsh (I think it can be done through zstyle) but can only be done on a command-by-command basis in bash. – Gilles Jun 22 '16 at 18:49
  • Unfortunately, zsh is not a viable option for me at this time. I'm interested in a potential solution for bash, specifically. – StrugglingProgrammer Jun 22 '16 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.