#WebStorm Cygwin with "PowerBash"
Begin with the guide by @nullivex here for general installation. NOTE: This is all with 32-bit stuff even on x64 platform. Cygwin32, and WebStorm and Node.js etc all set up 32-bit. You may skip the Git parts of that guide, and instead install Cygwin and the git and openssh it contains. Otherwise, you must NOT set up git in Cygwin so that the Native Git is found. But, that would sort of negate most of the gains herein. If you already use Cygwin and its git and have openssh keys all set up for Github and etc, this is a way to keep one set of configurations, and a familiar shell.
This will set up WebStorm to use Cygwin versions of everything except for:
Node.js(because there is noCygwinversion currently)Python(because some of theNode.js/npmthings don't play well withCygwin Python)Gtk(because theCygwinversion generally never plays well with Native apps also involved)
Further, it will set up PowerShell to launch with a more Cygwin-like environment (bash and all). By extension, this also fixes the bad Ctrl-C handling in PowerShell and other issues (like learning a brand new shell for no reason). You must have git and ssh and friends all installed and configured on Cygwin and WebStorm seems to work fine without native Git installed at all. Note that bash set up as your Terminal Settings in WebStorm will not directly work due to some incompatibilities (the executable used in Terminal Settings must support Windows Console API, and Cygwin does not).
##Reset PATH environment variables
Set your paths similar to these, in your System properties:
######System PATH env var
%SystemRoot%\command;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0;C:\Python27;%ProgramFiles(x86)%\GTK2-Runtime\lib;%ProgramW6432%\Microsoft SQL Server\110\Tools\Binn;%ProgramFiles(x86)%\ATI Technologies\ATI.ACE\Core-Static;%ProgramFiles(x86)%\AMD APP\bin\x86;%ProgramFiles(x86)%\AMD APP\bin\x86_64;%ProgramFiles(x86)%\NVIDIA Corporation\PhysX\Common;%ProgramFiles(x86)%\Common Files\Microsoft Shared\Windows Live;%ProgramFiles(x86)%\Windows Live\Shared;%ProgramFiles(x86)%\QuickTime\QTSystem
######User PATH env var
C:\cygwin\bin;C:\cygwin\usr\bin;C:\cygwin\sbin;C:\cygwin\usr\sbin;%ProgramFiles(x86)%\nodejs;%USERPROFILE%\AppData\Roaming\npm
Adjust these to match your versions and/or strip out the AMD/Nvidia/Quicktime junk if you want, these were just my PATHs once I finished reordering and cleaning them up. These will allow you to use Cygwin binaries from normal PowerShell, or to run bash and then have almost full Cygwin powers, all within your WebStorm terminal.
##Allow scripts to execute
In a PowerShell shell (redundant?) execute these commands to open up the execution policy so it will run local scripts, including the 'autoexec' style one we're about to make, now called a 'profile script'. This is for an x64 PowerShell so if you have 32-bit you probably don't need the second line (it sets the policy for both 64 and 32, when on x64).
#####For Windows Vista, Windows 7, Windows 8 (does PowerShell even work on Windows XP?)
######If you have an "Administrator" level user account
Set-ExecutionPolicy RemoteSigned -Force & { Set-ExecutionPolicy RemoteSigned -Force } -RunAs32######If you have a "normal" user account
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser & { Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force } -RunAs32
The ampersand is supposed to be there. This sets the ability to run your profile script which we create next...
##Create your user profile script
Jack this in at your PowerShell prompt:
Get-Variable PROFILE
This is your PowerShell profile script, make the directory tree (probably won't exist) and then notepad the file, creating it. Put this in there:
Remove-Item alias:\ls & C:\cygwin\bin\bash.exe
Again the ampersand is important and intended. Exit this PowerShell session and then launch a new one, you should end up in "PowerBash" assuming you've got your Cygwin path set up correctly. Also if you exit the bash you are back in normal PowerShell, and 'ls' has been unaliased so it runs the Cygwin one.
##Prologue
Under this bash-under-PowerShell even shebangs work to run Win-native Node.js apps (with the #!/usr/bin/env node shebang). GNU Screen works but not that well (detatchment kills silently, doesn't keep things you had running, active). Vim even works fine as far as I can tell.
Updated using previous comments, which were then moderated because I am a BOFH.