tags:

views:

38

answers:

1

I love cygwin and the native windows version of gvim and I use them together all the time. The only problem I have is with cygwin path names. Gvim for windows doesn't understand them so I have to resort to typing things like:

gvim `cygpath -wa ~/scripts/myscript.pl`

Which is annoying!

I was wondering if there's a neat way of using autocmds to detect if a cygwin path has been provided and, if so, convert it to a windows path on the FileReadPre event. Does anyone know if/how this can be acomplished?

+3  A: 

There exist several solutions (see vim.wikia.com, cygwin category).

I'm maintaining the more flexible one: cyg-wrapper.sh (flexible in the sense it knows that (vim) flags are not pathnames, and it can even be told that "binary" flags like -c expect another argument that is not a pathname, and in the sense that it is not vim specific)

Regarding the invocation of cygwin executables from win32-vim, you won't have any troubles ... as long as the executable won't return pathnames expressed in *nix format. For all compilation related executables (gcc/make/doxygen/...) I also have a solution. In the past it was a simple standalone perl script (still available on vim.org). Now I have a full solution that does other compilation related stuff: BuildToolsWrapper (that requires lh-vim-lib on the same site)

Regarding things like :e /etc/hosts, I have no solutions. A long time ago, I've tried to play with FileReadPre & co, but I gave up along the way, and I don't remember why ^^'.

Luc Hermitte
Thanks for this, it works particularly nicely when combined with an alias in .bashrc. I.e.:alias gvim='cyg-wrapper.sh gvim'Allows me to type:gvim ~/scripts/myscript.shJust nicely :-)
Benj
This... is awesome! I've been looking for something like this for a while, I can't stand the GTK gVim on cygwin. ClearType is soooo much better.
Bryan Ross