7

I had oh-my-zsh installed for a while, and I could type a full path using only one letter, then press tab to case-insensitively autocomplete the whole thing. For example, if I had a file at ~/Documents/sites/great-site/great-file.txt, I could type vim ~/d/s/g/g and press tab and it would expand the path to the correct path, or if there were multiple possible paths, it would expand as much as possible and jump to where there was a conflict.

I uninstalled oh-my-zsh, because it was slow to start up and kept wanting to intrusively update. Is there a way to get this same case-insensitive completion and partial-word/one-letter style completion for file paths without oh-my-zsh?

  • I think that behaviour is pretty basic, all you need is to have autoload -U compinit and compinit in your .zshrc. – muru Nov 18 '14 at 22:00
5

I looked through the .zshrc and /etc/zshrc of my systems. From experimenting, to expand /v/L/S/c to /var/log/squid/cache.log, I needed three settings:

# These two initialize the completion system,
# providing the case-sensitive expansion
autoload -U compinit
compinit
# This sets the case insensitivity
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'

That last line was part of a few settings added by running compinstall. I'd suggest you run it too. compinstall doesn't add many settings, so you needn't worry about bloat.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.