Hi guys,
it's pretty cool to have zsh in msys2, but unfortunately it does not complete hard drives.
E.g: cd /c/<TAB> does not show possible completions for /c. But it works as expected for bash.
Any ideas about fixing this?
Greetings,
Ed
CC @mashir43
Within Msys2, running compinit breaks the autocompletion of paths.
Assuming you are using oh-my-zsh, comment out the whole sections "Load and run compinit" and "Load all plugins" within ~/.oh-my-zsh/oh-my-zsh.sh and restart your shell.
@baldrianbandit, would you know if this is a bug in MSYS2, or in zsh? If there is a way to fix this issue without disabling stuff (I assume compinit and plugins are generally useful and desirable features), maybe we can patch this and fix it for all users.
It works without compinit. But zsh without its completion system is somehow useless :cry:
Any ideas about fixing?
Hi guys,
With compinit loaded, try putting this line into your zshrc configuration file:
zstyle ':completion:*' fake-files /: '/:c'
You should be able to autocomplete on /c/whatever/file/or/directory.
If you need completion on more hard drives/partitions just add them after the 'c', eg.
zstyle ':completion:*' fake-files /: '/:c d e'
This is just a workaround and I do think that the issue should be fixed somewhere upstream. But never the less I've got autocompletion on /c, /d, etc. in zsh now.
Wow that's awesome, it works :+1:
I added the following snippet to my zshrc to get all drives automatically added:
# complete hard drives in msys2
drives=$(mount | sed -rn 's#^[A-Z]: on /([a-z]).*#\1#p' | tr '\n' ' ')
zstyle ':completion:*' fake-files /: "/:$drives"
unset drives
Thanks a lot @heinep.
After some further investigation I think fake-files is the only way to go.
This approach is also mentioned in From Bash to Z Shell.
Most helpful comment
Wow that's awesome, it works :+1:
I added the following snippet to my zshrc to get all drives automatically added:
Thanks a lot @heinep.