Since my websites are all on Linux servers, I spend a good deal of time using the terminal and SSH. When I'm forced to use Windows for web development, I use
Cygwin to replicate the Linux terminal. While Cygwin has served me well, recently I've grown frustrated with the default shell, because it's run inside Window's cmd.exe. Simple things like keyboard shortcuts for pasting from the clipboard don't work. Output becomes garbled when I resize the terminal window. CMD.exe will only save the 999 most recent lines.
Not content to deal with these annoyances, I spent some time today configuring Cygwin. The first step I took was to install the rvxt terminal listed under the "Shells" category in the cygwin install. I then had to update the C:\cygwin\cygwin.bat file. My file currently looks like this:
@echo off
C:
chdir C:\cygwin\bin
set EDITOR=emacs
set VISUAL=emacs
set CYGWIN=codepage:oem tty binmode title
rxvt -e /usr/bin/bash --login -i
I think the rvxt shell needs a little bit of style. So in my home directory, I created a .Xdefaults file with the following values:
Rxvt*geometry: 100x15
Rxvt*background: #000000
Rxvt*foreground: #cccccc
Rxvt*scrollBar: True
Rxvt*scrollBar_right: True
Rxvt*font: Lucida Console-14
Rxvt*SaveLines: 2000
Rxvt*loginShell: True
To get the HOME and END keys to work in bash, I added these lines to my .inputrc in the home folder.
# Home Key
"\e[7~":beginning-of-line
# End Key
"\e[8~":end-of-line
# Delete Key
"\e[3~":delete-char
# Insert Key
"\e[2$":paste-from-clipboard
Finally, I needed to remap the keycodes for emacs. I added these lines to my .emacs file. Remember that the .emacs files will need to be updated on each server you want to use.
(global-set-key [(meta O) (d)] 'backward-word)
(global-set-key [(meta O) (c)] 'forward-word)
(define-key function-key-map "\e[7~" [home])
(define-key function-key-map "\e[8~" [end])
That's it for now. I plan to keep this page updated with any additional fixes needed to make cygwin and rvxt suit my needs.