![How does smart tab completion work?](https://linux22.com/image/183719/How%20does%20smart%20tab%20completion%20work%3F.png)
If I type this command in zsh:
cd foo<TAB>
The shell is smart enough to show only directories that start with "foo".
Similarly if I type this command in zsh:
git commit a<TAB>
The shell is smart enough to show only files that start with "a" and have uncommitted changes in git.
Where do those smarts come from?