daveray / vimfiles

vimrc and friends
6 stars 0 forks source link

cygwin issues #1

Open mchampine opened 14 years ago

mchampine commented 14 years ago

Using cygwin vim (on Win7)

Note: after git clone, chmod +x ng.exe so you can run it..

Opening a clj file results in:

Could not determine the Namespace of the file.

This might have different reasons. Please check, that the ng server
is running with the correct classpath and that the file does not contain
syntax errors. The interactive features will not be enabled, ie. the
keybindings will not be mapped.

Reason:
Error executing Nail! (230)
connect: No error^M

I tried lots of things in .vimrc. Forcing windows=1 makes things worse because it can't even find ng.exe with windows style backslashes. Thanks for creating this environment - I just can't get it to work.

daveray commented 14 years ago

Hey. Thanks for giving it a try. Your using vim that ships with cygwin? I've only tested this using native Windows gvim. This would explain why you had to chmod ng.exe. As I mentioned in the blog post, I use as little of cygwin as possible :)

Note that I've never run this on Windows 7 either, only XP, so who knows what's changed?

That said, error 230 is ERROR_BAD_PIPE (http://msdn.microsoft.com/en-us/library/ms681382%28VS.85%29.aspx), most likely from the ReadFile call at bundle/vimclojure-2.2.0/lib/nailgun/ngclient/ng.c:351. Since this is related to stdin, I wouldn't be surprised if there was some weirdness in the pipe set up by cygwin when vim invokes ng.exe, which is a normal Win32 executable.

So, in short, I'm not sure, but here's two things I would try:

Hope this helps!

mchampine commented 14 years ago

Yes - that did the trick, thanks!

I was pretty easy to make my own nailgun client with gcc, but I also struggled with a few other things trying to get my environment (cygwin vim on Win7) to work.

I found I need ";" in the java classpath, but regular forward slashes, so I forced windows=0 vimfiles=c:/cygwin/home/me/.vim sep=:";"

Then, after a great deal of experimentation, I found out that only triple backslashes work correctly in the ScreenShell calls, e.g.

" Start vimclojure nailgun server (uses screen.vim to manage lifetime)
nmap <silent> <Leader>sc :execute "ScreenShell java -cp \\\"" . classpath . sep . vimclojureRoot . "/lib/*" . "\\\" vimclojure.nailgun.NGServer 127.0.0.1" <cr>

" Start a generic Clojure repl (uses screen.vim)
nmap <silent> <Leader>sC :execute "ScreenShell java -cp \\\"" . classpath . "\\\" clojure.main" <cr>

After that, it all seems to work. I haven't completed the config changes to make gvim work, maybe later..

daveray commented 14 years ago

I wonder if there's a way in vimscript to tell the difference between cygwin and unix. If possible, then we could fix the separator (btw, it's so dumb that Java uses different classpath separators on different platforms).

The triple backslashes is just plain weird. I have no idea why that's necessary.