How does smart tab completion work?

How does smart tab completion work?

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?

相关内容