Tuesday, February 6, 2007

Setting Cygwin Bash Shell Looks

As I posted earlier, I like to use Cygwin as a *nix-like shell to use under Windows, because the command tool is IMHO terrible to use.

Cygwin has a lot of *nix functionalities which are not supported under windows default installation which forces you to install a big variety of software from different vendors.

Cygwin has its own port of bash shell, but on the default installation the looks are kind of dull. I use rxvt port for cygwin to start my shell and I used some configuration settings as suggested by this article.

So, with small changes to the suggestions of the author to have a larger buffer and the size of the started window I came with this .Xdefaults file. It shold be placed in your home directory.

! ~/.Xdefaults - X default resource settings
Rxvt*geometry: 120x60
Rxvt*background: #000020
Rxvt*foreground: #ffffbf
!Rxvt*borderColor: Blue
!Rxvt*scrollColor: Blue
!Rxvt*troughColor: Gray
Rxvt*scrollBar: True
Rxvt*scrollBar_right: True
Rxvt*font: Lucida Console-12
Rxvt*saveLines: 10000
Rxvt*loginShell: True
! VIM-like colors
Rxvt*color0: #000000
Rxvt*color1: #FFFFFF
Rxvt*color2: #00A800
Rxvt*color3: #FFFF00
Rxvt*color4: #0000A8
Rxvt*color5: #A800A8
Rxvt*color6: #00A8A8
Rxvt*color7: #D8D8D8
Rxvt*color8: #000000
Rxvt*color9: #FFFFFF
Rxvt*color10: #00A800
Rxvt*color11: #FFFF00
Rxvt*color12: #0000A8
Rxvt*color13: #A800A8
Rxvt*color14: #00A8A8
Rxvt*color15: #D8D8D8
! eof

Later I did another small change on the cygwin.bat file to use vim instead of vi as the default editor. The cygwin.bat file can be found on the installation directory of cygwin. Save the original file with another name and then replace it with the following content.

@echo off
chdir C:\cygwin\bin
set EDITOR=vim
set VISUAL=vim
set CYGWIN=codepage:oem tty binmode title
rxvt -e bash --login -i

Now when you start cygwin, the shell window will look like the one on the right (click on it to see a larger version). Play around with the collor definitions on the .Xdefaults file to have a setup that pleases you. .Xdefaults gives a lot of possibilites and you can see some examples here, here and here.

1 comment:

Daniel Meyer said...

Thanks for this post! I've set up my keyboard shortcut to bring up a bash prompt instead of a Windows command prompt. Funny, but it makes a difference (to me anyway) to have it in an rxvt window instead of Cygwin's default of bash-in-a-Windows-command-prompt. The better aesthetics cut down on the friction of using it that much more. I wrote a little post about it myself.

Thanks for writing this up!