Oh-the-zsh style completion for directory/file paths without oh the zsh

autocompleteoh-my-zshzsh

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?

Best Answer

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.