Daniel Lemire's blog

, 1 min read

Using Vim under Cygwin

Cygwin is a marvelous idea: run a Linux-like shell under Windows. It allows me to run Python, CVS, Perl… almost everything I use under Linux, under Windows. Well, it doesn’t quite work as well, but for small things, it does the job.

One thing that has annoyed me is their implementation of vim. The keyboard support is bad. In my .inputrc, I have these lines

# enable 8-bits characters ...
set meta-flag on
set convert-meta off
set output-meta on

They seem to clash with vim in a bad way. Ah! But you can also install a version of vim running directly on top of windows. If you do this, then you can use this other version instead of the one that comes with cygwin.

All I had to do was to create this little script:

 "/cygdrive/c/Program Files/Vim/vim63/vim.exe" `cygpath -w $1`

The trick here is that you need to convert Linux-like paths (like /tmp) into Windows path (C:…). My little script is bad in many ways, but it will work if you call vim with only a file name as an argument.

My solution does fail in some nasty ways. For example, when I do a CVS commit, I can’t enter my comment. Bad.

See also my post Grep is just not for matching lines anymore.

Subscribe to this blog
in a reader
or by Email.