3

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?

Benj
  • 31,668
  • 17
  • 78
  • 127

1 Answers1

6

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
  • 31,979
  • 7
  • 69
  • 83
  • 1
    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.sh Just nicely :-) – Benj Jul 02 '10 at 10:29
  • 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. – rossipedia Jul 02 '10 at 15:21
  • I have another question about cyg-wrapper - care to chime in? http://superuser.com/questions/298792/how-to-use-cyg-wrapper-to-fork-a-new-tab-in-win32-gvim/ – Myer Jun 20 '11 at 21:22
  • Thanks for the wonderful `cyg-wrapper`; it deserves to be better known. – Nick Hutchinson Aug 04 '13 at 18:38