jaxbot / browserlink.vim

Live browser editing for Vim
MIT License
711 stars 38 forks source link

Gvim will not startup when Browserlink is added. #27

Closed ReneFroger closed 10 years ago

ReneFroger commented 10 years ago

Next that the name Brolink is changed now, I noticed something else.

I decided to try Browserlink. So I installed Node.js today. But I found a issue with Vim/Browserlink, even when Node.js is not started yet.

Setup

Environment Information

My whole vimrc:

set nocompatible   
execute pathogen#infect()
filetype plugin indent on

Plugins There are 3 plugins installed.

Problem

After adding Browserlink, when I'm trying to start Vim, it will even not show up. There is nothing like a Vim proces in the task manager.

When I decided to delete Browserlink, Vim will start up as usually. Even when I have only 1 file stored: bundle/browserlink/plugin/brolink.vim, Vim will not show up. But will do when I delete Browserlink. What went wrong here?

jaxbot commented 10 years ago

Sounds like it is hanging when it tries to launch Brolink, which then halts the Vim thread, or crashes it entirely.

Most likely, the problem has to do with the differences in Windows' slashes. When I get some spare time, I'll try it out on my Windows 8 VM and see what happens.

Thanks for the detailed report and sorry it's not working out of the box!

ReneFroger commented 10 years ago

Thanks for your reply. Yes, Windows is not a useful OS. But alas, I'm bounded to Windows due to work requirements and specific work tools. If I could get this working, it would change my life. Or to impress the female coworker next to me. :)

Looking impatiently forward to your test!

jaxbot commented 10 years ago

I impressed my female and now she uses Vim too ;)

But yeah, I originally wrote Browserlink on Windows so it should be feasible, just need to figure out the path thing. Hopefully can do it by this weekend, but I have some quizzes and crap this week so I'll see

jaxbot commented 10 years ago

If you manually run node brolink.js in the bundle/browserlink.vim/brolink folder, does the plugin work?

ReneFroger commented 10 years ago

Ah, then Vim will start then now. But I get an error.

line   26:

E887: Sorry, this command is disabled, the Python's site 
module could not be loaded.

Probably this is a issue of my own Vim setup. However, I have pyhton27.dll and python33.dll installed in the Vim folder, and Vim compiled. I will sort this first out, and then let you know if Brolink works!

ReneFroger commented 10 years ago

Are you using Python 2.7 or Python 3.3/3.4?

I installed Python 2.7 32-bit again, and removed Python 2.7 64-bit and 3.3 on my Windows computer. Restarted again.

In cmd.exe:

python -c "import struct; print struct.calcsize('P')*8"

Gives 32. I assume this means 32-bit. In Gvim:

:echo has("python)

Gives 1. Then I try:

 :py print "hello"'

Displayed hello in command line.

So, Python seems to be working in Gvim. Python seems in my path, given the status of cmd.exe. But every time when I add Brolink to Bundle folder (Pathogen plugin), Vim is not able to start.

I started nodejs.exe. Then node C:\Dropbox\Vim.vim\bundle\jaxbot-browserlink\brolink\brolink.js

I'm seeing only this: ....

Then starting Gvim. But it don't start. I don't get any error or something. Could you give some hints where I'm propably doing wrong? I noticed this is not your plugin, but something in my setup. Valloric's MatchTagAlways is not working too (Gvim will not start up when added), and it uses Python too.

ReneFroger commented 10 years ago

Yeehaaaaaaw!! Don't ask me how, but after many abhorrent struggles with path, backslash, dll, OS-config and whatever nerd talk, I got Python + Vim working. Eat that, Vim. Okay, we're back in town now. Gvim starts fine with Browserlink now.

First, I start Node.exe, I type node C:\Dropbox\Vim.vim\bundle\jaxbot-browserlink\brolink.js I see only this: .... Mmmkay. Then I start Chrome. In Tampermonkey, the script is already added. Tampermonkey detects the page correctly when I'm loading it, and loads the script.

Okay. When I start Vim, and I save the file. I get a error.

Error detected while processing function <SNR>38_sendCommand:
Line 6
Traceback (most recent call last):
File "<string>", line 4, in <module>
vim.error Vim(call):E484: Can't open file (*** filename of temporary file, it's changed every time ***)

But the file is saved anyway. But the browser will not refresh. The error occurs always when I'm saving the same file or another files in another directories. When I removed Browserlink plugin, the error will not be showed again.

Any idea what's going on there?

jaxbot commented 10 years ago

Hm, I have a good idea of what is wrong. If you want to tinker with the code, try commenting out line 55:

        call system("cd " . s:path . "/../brolink && ./start.bat")

Otherwise, I'll get to it in the next few days

ReneFroger commented 10 years ago

I tried, and couldn't get working. Any news on this?

ReneFroger commented 10 years ago

I tried again. I get the response that python27.dll couldn't be loaded, while the same python27.dll is in my path folder (which happens to be Vim74 binary folder too).

:version for gvim.exe confirms -DFEAT_PYTHON -DDYNAMIC_PYTHON DYNAMIC_PYTHON_DLL="python27.dll" And echo $PATH confirms python27.dll is in the folder of search path.

What else can I try?

jaxbot commented 10 years ago

Have you tried using builds from here? That's how I had it running on Windows:

http://tuxproject.de/projects/vim/

ReneFroger commented 10 years ago

Well, with your link I got it worked without any errors. Thanks! I find it weird, in the past, I used Veegee's 64-bit Vim and Harroogan's Vim 32-bit and there I got errors.

But anyway, I still have some questions. I see my browser page is updated when I save the file in Vim. But I noticed that in some of your screencast GIF's you don't save, like in the latest on Brolink page. I see that the browser is instantly updated when you insert text. So I'm not sure if it's that possible?

Another questions is that you mention to set window.__BL_OVERRIDE_CACHE = true, but I couldn't find where I could set that in Chrome Inspector or Vim either.

Enlighten me, please. Then I will not bother you anymore! :smile:

jaxbot commented 10 years ago

Awesome, glad to hear!

As for the screencast, which one are you referring to? I've always set to it update on save, the one on the top updates when I press C-S, which is a remap to :wq for me. You could probably set an autocmd to BLReloadPage or BLReloadCSS to auto update as you type, though. I like mine only updating when I save because otherwise I can get the HTML/CSS/JS in an invalid state while typing and destroy the page rendering, which is relatively unpleasant. Something like this might work though:

autocmd * InsertLeave :BLReloadPage

As for window.__BL_OVERRIDE_CACHE, I use that for disabling the cache breakers in the path if I'm using the Chrome Inspector's workspaces to edit CSS in Chrome and sync it back to Vim. Updating cache breaker made Chrome think there were multiple CSS files, so that flag disables it.

I think it's about time I overhaul these docs. :tongue:

ReneFroger commented 10 years ago

For first comment, take a look in help for :update instead :w for saving. Every little improvement to polish your Vim will eventually make a big difference in long run. :smile:

But your second answer: this is not what I mean. My question was: where do you set window__BL_OVERRIDE_CACHE specifically?

jaxbot commented 10 years ago

For first comment, take a look in help for :update instead :w for saving. Every little improvement to polish your Vim will eventually make a big difference in long run. :smile:

Actually, I do use :update, come to think of it! Thanks for the hint

But your second answer: this is not what I mean. My question was: where do you set window__BL_OVERRIDE_CACHE specifically?

On the page that has the browserlink JS loaded into it. Either add it to a tampermonkey script or embed it in a page

ReneFroger commented 10 years ago

Ow, in tampermonkey. I get it. And in the case you might be interested, I asked some questions in Neovim community about adding autowriting without freezing the brolink workflow.

I'm happy with your preciousss Brolink. Thanks for all your contributions!