Wednesday, October 07, 2009

Speeding up zsh completion

Hello,
since I've started using zsh, a great shell with great out of the box completion, one of the most boring issues was having a really slow completion. I can understand it could be slow to get a list of packages, remote files or command line options, but also paths were often slow to be completed. After lots of searches I've ended up in adding this magic line to my ~/.zshrc:
zstyle ':completion:*' accept-exact '*(N)'
This way you tell zsh comp to take the first part of the path to be exact, and to avoid partial globs. Now path completions became nearly immediate.

Another important speed up is using the cache for packages and other stuff:
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache
If you know how to boost up options/remote files, please share :)

6 comments:

Benji Orozco said...

I've been wanting to learn zsh for a while but I can't find a good tutorial, including their configuration compared to bash. Do you know a good one?

Luca Bruno aka Lethalman said...

Not that I know. Check zsh lovers, run the initial configuration. All the configuration is made with setopt and completion, that's it. Search for existing zshrc on internet. I'll post mine as soon as it's cleaned up.

Teeagoo said...

Really works very well! Thanks

Anonymous said...

as config I suggest to look here: http://ft.bewatermyfriend.org/comp/zsh.html

and the zsh talk too. (I don't like irc log, coz are not easy to read and very noisy, but you can try to enjoy it)

d.

shopping cart said...

zsh, i have used myself and found it reliable.

Tony Ashley said...

Good stuff, zsh tips are always nice to see outside of the textbook they call `man zshall`. :)