Cygwin + Rxvt

This works great. Stolen from here.

Cygwin + Rxvt

I’ve been playing around with Cygwin since I’m forced to run WinXP on my work laptop. Cygwin’s great, I’ve used it on and off since when it was GNU-Win32 by Cygnus, but there’s a lot of improvements to it in the last year or two.

One of the things that’s irritated me is that the default console uses the cmd.exe shell as a base – makes it hard to copy + paste with the mouse, among other things. After some effort, I found the right combination of tweaks to get Rxvt working as a decent console in Cygwin.

[You’ll of course have to install Rxvt from your favorite Cygwin mirror. – Lee]

Step 1: Edit ~/.Xdefaults – the settings below create an 80×80 terminal window with a deep-blue-black background and yellow-white text (looks nice, easy on the eyes) and assign VIM-style color codes:

(see comment 6. A change might be needed to this code. I haven’t tested it yet but you might need it. Tell me if it works for you please)

! ~/.Xdefaults - X default resource settings
Rxvt*geometry: 80x80
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: 2000
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

Step 2: Modify your c:cygwincygwin.bat to invoke your shiny new Rxvt instead of cmd.exe:

@echo off
C:
chdir C:cygwinbin
set EDITOR=vi
set VISUAL=vi
set CYGWIN=codepage:oem tty binmode title
rxvt -e bash --login -i

7 Comments

  1. jas says:

    Nice one, Lee, many thanks.

    I’ve been wandering in the Win2k, XP/SPn wilderness for so long i’ve
    forgotten most of the good stuff. My notes are gone, too, from the
    years with Slackware, OpenBSD, etc., except for a few crinky sheets
    in a floppy plastic binder.

    Don’t even have my own computer anymore, just work provided laptops
    and on-site desktops.

    Finally got one i could put cygwin on, today’s the first day and it’s
    like coming home … many thx for the sample xdefs.

    jas

  2. Hubert Samm says:

    Excellent…. because of this, I’ll no longer need putty… I can do everything with cygwin…

  3. Lee says:

    All I can say is…. R0x0r!

  4. jas says:

    R00r indeed! i wouldn’t be without Rxvt and can’t imagine using anything less. Or vi, or perl, or egrep, or …, or …

    But there’s still some things i haven’t done with cygwin – like use OpenSSL to gen a Cert & CA as if i was on a real computer, or even to get & install (by hand) the latest & greatest updates of my favorite tools ‘n software.

    My only concern is the fragility of the XP platform; i’d hate for it to lose its brains whilst doing _actual_ computer stuff under its very nose, and then having to fix some awful mess (on a client’s machine!) later on.

    But Rxvt, man, it’s a champ, thx again Lee.

    jas


    http://shakira.com

  5. Lee says:

    From what I’ve seen, as long as it’ll compile and run on Cygwin, it’ll work solidly. I’ve seen that the server side of BoxBackup won’t run on Cygwin because it uses lower level file system calls or somesuch. I haven’t heard any other issues, though I’m not as leet as I used to be.

    Go for it. It scares the WinMundanes.

  6. tom says:

    There is a small typo, though. It should be “saveLines”, not “SaveLines”.

  7. Andrew says:

    Anyone else have a problem with VIM killing the rxvt window? And all of a sudden my X-forwarding doesn’t work via ssh. It works fine and I can use VI and VIM with a cmd.exe terminal. Any one know why it is doing this?

Leave a Comment

Do not write "http://" in your comment, it will be blocked. It may take a few days for me to manually approve your first comment.

You can edit your comment after submitting it.