Tuesday, October 2, 2012

zsh cd tab completion slow

It is quite annoing that zsh seems stuck when completion using tab in a huge directory.

To speed up the zsh completion, append the following lines to ~/.zshrc

# Speed up the zsh completion

zstyle ':completion:*' accept-exact '*(N)'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

Sometimes, the directory auto completion works slow under git and svn directories.The solution is to disable it from getting git info and svn info:

For GIT, add following to .zshrc:

__git_files () {
    _wanted files expl 'local files' _files  

For SVN, append this line to .zshrc:

compdef -d svn