14

Although I've used Oh-My-Zsh in the past, I decided this time around (i.e. setting up a new computer) I'd try to avoid installing it to keep things a bit leaner. Right now I'm trying to cherry-pick Oh-My-Zsh's insensitive tab-completion feature. Digging around its source repo, I found the following line:

zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'

I'm fairly confident this is the line Oh-My-Zsh executes to do what I want, so I tried adding it to my .zshrc. Restarted my terminal. Typed cd desk, then hit [tab]. No dice -- I didn't get cd Desktop/.

Here's the entire .zshrc for reference:

# pure shell theme autoload -U promptinit; promptinit prompt pure # completion definitions zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' fpath=(/usr/local/share/zsh-completions $fpath) # syntax highlighting (must be last line) source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 

What am I doing wrong?

1

1 Answer 1

30

Just had to autoload and run compinit.

Here's the new .zshrc:

autoload -U compinit promptinit promptinit prompt pure compinit zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' fpath=(/usr/local/share/zsh-completions $fpath) source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 
Sign up to request clarification or add additional context in comments.

3 Comments

Hello, after switching from Bash to Zsh on macOS Catalina, Tab completion stopped working for me. Apparently it is working in directories where git is initiated, but not outside. What can I do?
@SEJU Try the command: rehash (From zsh guide: The way commands are stored has other consequences. In particular, zsh won't look for a new command if it already knows where to find one. If I put a new ls command in /usr/local/bin in the above example, zsh would continue to use /bin/ls (assuming it had already been found). To fix this, there is the command rehash, which actually empties the command hash table, so that finding commands starts again from scratch.)
@Jim has the correct answer here (at least for me)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.