A few Cygwin tips.

September 25, 2011

My primary work laptop these days is a Windows 7 machine.

In an effort to make this a more Linux-friendly environment, the first thing that I installed on it was Cygwin, a collection of tools which provide a Linux look & feel and compatibility layer on Windows.

As an aside, the second thing that I installed was Tomboy, because Gnote is not available for Windows. Over the years, the Tomboy/Gnote application has become essential to my daily workflow.

What am I using Cygwin for? First and foremost, as an SSH client into my Linux desktop and a bunch of other Linux boxen, where all the real work gets done. For me, PuTTY isn’t a good enough SSH client for Windows. Secondly, for text editing with vim and nano. Finally, Cygwin provides the comfortable environment of bash, grep, less, find, and all the other main Linux utilities.

If you are also using Cygwin, here are some of my suggestions for maximizing your user experience:

(1) Install mintty, which is part of the Cygwin package set though not selected by default. It is far superior to the default Cygwin terminal emulator.

(2) Install the ncurses package so that the clear command will exist in your environment.

(3) Remove the bash-completion package, which dramatically speeds up the time between launching a mintty instance and getting a prompt.

(4) Configure vim to remember the last location of your cursor by adding the following to .vimrc:

" Only do this part when compiled with support for autocommands
if has("autocmd")
  augroup redhat
    " When editing a file, always jump to the last cursor position
    autocmd BufReadPost *
    \ if line("'\"") > 0 && line ("'\"") <= line("$") |
    \ exe "normal! g'\"" |
    \ endif
  augroup END

(5) Improve bash completion by adding the following to .inputrc:

set show-all-if-ambiguous on
set mark-directories on
set mark-symlinked-directories on