Configure Webstorm to Use Babun Shell

Instructions for setting up Babun (zsh) as Webstorm terminal. I’ve recently been shown Babun and having it replace GitHub for Windows shell in Webstorm was the last piece of my happiness. The tricky part was to have it open in the current working copy and not the default home path.

I found these instructions somewhere on the web ~~but forgot where it was~~. It’s quite simple and required some minor tweaks so here’s how I have it set up.

1 Go to Babun installation folder (for me it’s %USERPROFILE%\.babun)

2 Create a batch file. I called it cygwin.bat

3 The batch script is

1
2
3
4
@echo off
set currentdir=%cd:\=/%
@echo cd %currentdir% > "%USERPROFILE%\.babun\cygwin\home\%USERNAME%\.bashrc_cd"
call %USERPROFILE%\.babun\cygwin\bin\bash --login -i -ls

4 Add the created script as terminal command in Webstorm settings (you cannot use %USERPROFILE% variable here)

Webstorm settings

5 Add the following to %USERPROFILE%\.babun\cygwin\home\%USERNAME%\.bashrc

1
2
3
4
if [ -f "${HOME}/.bashrc_cd" ]; then
   source "${HOME}/.bashrc_cd"
   rm "${HOME}/.bashrc_cd"
fi

6 Enjoy!

Webstorm terminal

Comments