将Markdown-Live-Preview-in-vim插件从* nix移植到Windows [英] Porting a markdown-live-preview-in-vim plugin from *nix to Windows

查看:92
本文介绍了将Markdown-Live-Preview-in-vim插件从* nix移植到Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要您的帮助.因为我不知道自己在做什么.

有一个不错的插件 vim-instant-markdown 我最近偶然发现.基本上,它是在浏览器中的实时预览,在后台运行,同时您在markdown插件中编写文本时,我喜欢这个概念.

There is this nice plugin vim-instant-markdown I recently stumbled onto. Basically, it's a live preview in a browser, running in the background, while you're writing your text in markdown plugin, and I like the concept.

因此,我尝试使其在Windows上运行,

So, I've tried to get it to work on Windows,

  • installed Ruby (rubyinstaller-1.9.3-p125)
  • installed Ruby-DevKit (DevKit-tdm-32-4.5.2-20111229-1559-sfx)
  • followed instructions on https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
  • gem install redcarpet pygments.rb
  • installed node (node-v0.6.10)
  • npm -g install instant-markdown-d

到目前为止一切顺利,

我在Vim中打开一个markdown文件,它打开了一个命令行窗口,其中包含我的文字(暂停按钮在这里起作用).浏览器在任何地方都看不到.

I open a markdown file in Vim, and it opens (pause button works here) a command line window with my text inside. Browser not seen anywhere.

在插件中有一个/dev/null东西"(我不是一个Unix家伙,比我需要的更多,不是很多-大部分情况下只是一个普通用户). /dev在Windows上不存在.

In the plugin there is an /dev/null "thing" (I'm not an unix guy, more than I needed to be, which wasn't very much - just an ordinary user for most part). /dev doesn't exist on Windows.

长话短说,我的问题是-可以使它在Windows上运行,应该以何种方式工作,还是要使其工作才能浪费时间?

To put long story short, my question is - can this be made to work on Windows, the way it should work, or is it a waste of effort even to try it to get it to work?

我欢迎所有建设性的想法和建议.

推荐答案

很高兴您发现此功能足够有用,它需要Windows端口!我认为绝对可以做到,您可能需要更多的依赖关系和黑客手段.

glad you found this useful enough to want a Windows port! I think it definitely can be done, you just might need more dependencies and hackage.

首先,请了解除了实际的.vim文件之外,还有一个服务器组件可用于执行此工作,该服务器组件可按需启动和停止.您肯定需要查看其代码,可以在此处找到.

First of all, understand that there's a server component that is used apart from the actual .vim file to make this work, which is started and stopped on demand. You will definitely need to look at its code, which can be found here.

服务器在OSX上使用open在Linux上使用xdg-open打开浏览器窗口,而Windows都不存在.在Windows上,您可以使用start(更多此处).尝试找到一种方法使浏览器窗口在后台打开,而不是失去焦点,否则会很烦人.

The server uses open on OSX and xdg-open on Linux to open a browser window, neither of which exist on Windows. On Windows, you can use start (more here). Try to find a way to make the browser window open in the background, and not steal focus, otherwise it will be very annoying.

此外,curl用于将命令发送到服务器,而curl在Windows中不存在.的确,我认为没有类似的东西存在.有一个 curl Windows端口,尽管IMO有点讨厌添加诸如插件要求...

Also, curl is used to send commands to the server, and curl doesn't exist for Windows. Indeed, I don't think anything similar exists. There is a curl Windows port, though IMO it kinda sucks to add such a thing as a requirement for the plugin...

看来您至少已将这作为学习经验,所以我希望您能够使其正常运行并发送回撤请求! (当然,如果您遇到问题,可以随时提出问题),但是(如果不太可能)您失去兴趣或放弃了,请在github中创建一个问题,请求Windows兼容性,我看看是否有时间实施它.另外,请记住,某些问题/评论会比此处更适合项目的问题领域.

It seems that you've taken this on at least partially as a learning experience, so I hope you can make it work and send back a pull request! (Of course feel free to keep asking questions if you're stuck) But in the (hopefully unlikely) event that you lose interest or give up, create an issue in github requesting Windows compatibility, and I'll see if I have time to implement it. Also, keep in mind that some questions/comments will be better suited to the project's issues area than here.

祝你好运!

这篇关于将Markdown-Live-Preview-in-vim插件从* nix移植到Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆