Using vim, how do you quickly refresh a web page you're working on?

…衆ロ難τιáo~ 提交于 2019-12-10 09:53:09

问题


I've been using VIM for a few weeks now while messing with various web languages and I'm really enjoying it.

I find it cumbersome having to tab or click into my browser and refresh the page to see the effect of a code change. It's even more annoying as I'm using Virtual Box and I tend to be working from PDF files on the host system so I have limited window space.

Do you gurus have any fancy ways of doing this? I was wondering if it's possible to split the VIM workspace and have links/lynx in a window of its own or something to that effect?

edit:

out of curiosity, if anyone is still glancing at this:-

is it possible to execute a browser from vim and load a URL based on a variable of sorts?

:! firefox http://localhost/bla/$CURRENTWORKINGFILE

sort of thing?


回答1:


I don't know how to do this in specific, but I know of two plugins which let you communicate with a shell from within VIM:

  • http://code.google.com/p/conque/
  • http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/



回答2:


If you are developing locally where no one cares, how about setting some JS to refresh the page?

<script>
setTimeout(function() { location.reload() }, 60000 );
</script>

That way you can keep working in vim and take a glance at the web page every min or so to see it refresh. This should work for most web pages.

I do this on dual monitors by leaving VIM open on one monitor and the browser on the other.




回答3:


Use an app called XRefresh.



来源:https://stackoverflow.com/questions/3065334/using-vim-how-do-you-quickly-refresh-a-web-page-youre-working-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!