Handy Hack: Run vim for Windows under Cygwin
Posted by Alec on 9 October 2008
UPDATED 30/Jan/09. With apologies for any confusion, previous example was completely wrong
For reasons I cant quite remember running the Windows gvim.exe binary directly from bash can lead to problems parsing path names. So I created an function as follows:
function gvim() { (
unset a
for i in "$@"; do
case $i in
-*)a=" $i $a";;
*) if [[ -f $i ]] ; then
a=" $a $(cygpath --absolute --dos "$i" )"
else
touch "$i" &&
a=" $a $(cygpath --absolute "$i" )" &&
rm -f "$i"|| echo "failed"
fi
esac
done
/progra~1/vim/vim72/gvim.exe $a&)}

