Sunday, August 21, 2005

Cygwin tips

One feature that I could not live without when developing on Windows is the "Open Command Window Here" Windows Explorer context menu. I also use Cygwin a lot when developing on Windows and wanted this same functionality for opening a Cygwin window.

I found this blog entry discussing how this can be done. I ended up tweaking this solution a bit so that I could open the rxvt terminal window rather than the bash shell in a DOS window. Here's what I came up with:

[HKEY_CLASSES_ROOT\Directory\shell\bash]
@="Open Bash Shell Here"

[HKEY_CLASSES_ROOT\Directory\shell\bash\command]
@="c:\\cygwin\\bin\\rxvt.exe -e bash --login -I -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

[HKEY_CLASSES_ROOT\Drive\shell\bash]
@="Open Bash Shell Here"

[HKEY_CLASSES_ROOT\Drive\shell\bash\command]
@="c:\\cygwin\\bin\\rxvt.exe -e bash --login -I -c 'cd \"`cygpath \"$*\"`\";bash' bash %L"

You will need to copy and paste this to a .reg file and import it into your Window's registry. You also need the rxvt package for Cygwin.

Another Cygwin tip I came across the other day that is useful for Ant users is adding the following line to your .bash_rc file:
export ANT_ARGS='-logger org.apache.tools.ant.listener.AnsiColorLogger'

This will add color to the output from Ant running in terminals that support ANSI color codes.