MSYS2

I’m used to the bindings provided by Oh-my-zsh git plugin in my archlinx. However when working on my main Windows 10 workstations the git windows client comes with mingw bash. Thus I was looking for a way to get zsh installed on windows. There are actually two way to do this. You can use WSL(Windows Subsystem for Linux) or MSYS2. I tried WSL for a few month. It was pretty good. However the cavet is although you can install zsh via package manager. You cannot set it as default shell. So I have to put zsh in my .bashrc and have bash run zsh. This is not a elegant solution. Then I found another way to do this, which is a tool called MSYS2.

According to their webiste, MSYS2

MSYS2 is a software distro and building platform for Windows. At its core is an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software. It provides a bash shell, Autotools, revision control systems and the like for building native Windows applications using MinGW-w64 toolchains.

So looks like it is a fork of Cygwin, which means I should be able to ditch the cygwin installation on my system.

Change repo

MSYS2’s official repo no longer works (at least not for me). I need to change the repo in /etc/pacmand.d/ in order to get pacman works.

#/etc/pacman.d/mirrorlist.mingw32:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686

#/etc/pacman.d/mirrorlist.mingw64:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64

#/etc/pacman.d/mirrorlist.msys:
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch

Add to right-click menu

I used script at: (https://github.com/njzhangyifei/msys2-mingw-shortcut-menus)

Change default shell

in msys2 root folder, modify msys2_shell.cmd file. Set LOGINSHELL to zsh