Tuesday, 9 February 2010

cygwin - alternative shells

While I love cygwin, I've never been totally happy with the standard Cygwin Shell Console, mainly in the way that it handles copy/paste, fonts and colour setting. But mainly copy/paste. :)

Well, I've finally got around to reseaching some replacements, and like what I've found!

Basically, I found a couple of good alternatives: mintty and rxvt. Neither of these require use of X, and both are available as optional packages that you can select from the standard cygwin installation.

Note: neither of these work right with non-cygwin utilities that require piping. You need to keep the normal Cygwin Shell Console for that.

mintty (http://code.google.com/p/mintty/)

When you install this as a cygwin component, you'll find a shortcut created for you automatically under the Start menu.

Next, I modified the shortcut to look like this:

C:\cygwin\bin\mintty.exe bash -li

However, when I started cygwin using this shortcut, my normal .profile scripts weren't picked-up properly. To fix this, I had to modify /etc/profile and add a line like this...

export HOME=/cygdrive/c/home

mintty then launches.

What I love about this is that it gives a fully UTF-8 enabled shell, where it is really easy to cut/copy/paste text, and very easy to change colour schemes.

Just right-click on a mintty window to see the copy/paste etc. options; dead easy.

If you want to spawn-off a new console, use an alias like this:

alias mintty='mintty --size=100,70 bash --login -i &'

mintty

rxvt

This is also available under cygwin, but isn't fully Unicode aware, so isn't as good as mintty. You'll see problems for example when you try viewing a manual page; look at the funny text you get when you try this...:

man bash

That said, here is what I did to get it working.

Basically, I took a copy of the cygwin.bat file, and modified part of it like this:

rem bash --login -i
rxvt -sr -sl 2500 -sb -geometry 100x70 -fg black -bg white -tn rxvt -fn "Lucida Console-12" -e /usr/bin/bash --login -i

I also created an alias in my .profile file, that allows me to launch new rxvt windows easily.

alias rxvt='rxvt -sr -sl 2500 -sb -geometry 100x70 -fg black -bg white -tn rxvt -fn "Lucida Console-12" -e /usr/bin/bash --login -i&'

With rxvt, you get a paste operation in one of two ways:
- Ctrl-Shift-LeftButton
- middle (press mouse wheel) - no good for MacBook devices with Track pad!

No comments: