When I want to traverse between directories, zsh is throwing a screenfull of tab completions. It's making the experience very bad. How can I get only few suggestions?
Asked
Active
Viewed 161 times
1
-
You mean `cd` completions are numerous? What's in your `PATH`? – Jens Feb 20 '22 at 10:36
-
Yeah cd completions. I am using Ubuntu on wsl2 and my path contains windows directories too.. okay, there's all the mess coming from. How can I not get cd completions from windows folders? – nikhilreddydev Feb 21 '22 at 03:50
-
Do you need the windows folders in your PATH? If not, remove them. There may also be a `CDPATH` variable. Any excess directories in there? – Jens Feb 21 '22 at 13:26
-
CDPATH is empty. How do I remove windows folders from path? Can you guide me please? – nikhilreddydev Feb 23 '22 at 04:15
-
You simply set `PATH=/bin:/usr/bin:/some/other/dir` in your `.zshrc`. You can test if this has any effect on the command line first with `OLD=$PATH`, `PATH=/bin:/usr/bin:...`, `rehash`. Undo with `PATH=$OLD`. – Jens Feb 23 '22 at 06:50
-
Thank you @Jens. I finally set my path to only /bin. And now completions are a bit cleaner. – nikhilreddydev Feb 24 '22 at 10:39
-
Only `/bin` might be a bit underpowered. It's better to use the system default, which you can query with `getconf PATH` and set with `PATH=$(/usr/bin/getconf PATH)`. – Jens Feb 24 '22 at 13:55
1 Answers
1
Turning the comment conversation into an answer.
- Check your
PATH
andCDPATH
variables for directories you don't need. - Assign stripped down values somewhere in your
.zshrc
. - A good value for
PATH
is the system default,PATH=$(/usr/bin/getconf PATH)
. - Add to your liking, maybe
$HOME/bin
and/usr/local/bin
if they exist.

Jens
- 69,818
- 15
- 125
- 179