- Download the latest zsh package: https://packages.msys2.org/package/zsh?repo=msys&variant=x86_64
Example:
zsh-5.7.1-1-x86_64.pkg.tar.xz
Update:
The package now is compacted using zstd
, so now we need some "special" extractor.
So, in my case, I've downloaded this file
https://repo.msys2.org/msys/x86_64/zsh-5.8-5-x86_64.pkg.tar.zst
And extracted it using the Peazip.
https://peazip.github.io/zst-compressed-file-format.html
- Extract the content to your git bash installation dir:
Usually C:\Program Files\Git
- Test it and config zsh:
Open git bash and type:
zsh
So, this step is important, it seems zsh
will ask a few configurations, like the tab completion, history, etc.
Please read the options and set that according to your use.
- Installing oh-my-zsh, execute the following cmd on git bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
- Configuring zsh as default shell
Edit the ~/.bashrc
file. (create it if it doesn't exist)
Add the following lines at the end of the file
# Launch Zsh
if [ -t 1 ]; then
exec zsh
fi
Close and open again the git bash.
- Installing the Honukay theme
curl -fsSL https://raw.githubusercontent.com/oskarkrawczyk/honukai-iterm/master/honukai.zsh-theme -o ~/.oh-my-zsh/custom/themes/honukai.zsh-theme
- Set it
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="honukai"/g' ~/.zshrc
Don't do this
It will initialize a bash environment when it runs the rc and profile.d scripts. You can inspect this by
echo $SHELL
.It better be set to
zsh
.Instead
Directly invoke zsh using mintty
"C:\Program Files\Git\usr\bin\mintty.exe" --dir "%USERPROFILE%" /usr/bin/zsh -l -i
This way all the rc and profile scripts will actually detect zsh and not run .bash scripts.
I also created a ~/.zshenv to set the missing environment variables that git-bash.exe hands to /bin/bash.
I removed a lot of my windows path entries so autocomplete is more responsive.
If you get this message:
It is because etc\profile.d\git-prompt.sh does not check the shell before including git-completion.bash
To fix it you can create an empty file
echo "" > ~/.config/git/git-prompt.sh
Also, make sure you have configured mintty for UTF8 and 256 colors:
cat ~/.minttyrc