Question

I want to use VIM to edit reStuctured text documents in a number of operating systems.

I found this posting http://www.zopyx.com/blog/editing-restructuredtext-with-vim

Can you help me come up with the line to achieve the same effect when run on a MS-Windows operating system?

Would it also be possible to to use an environment variable to specify the location of the temp file?

With an additional line in your .vimrc configuration file you can configure your own command that converts the buffer to HTML, saves the generates HTML on the filesystem and starts Firefox to preview the file:

.vimrc (LINUX):
:com RP :exec "Vst html" | w! /tmp/test.html | :q | !firefox /tmp/test.html

.vimrc (MacOSX):
:com RP :exec "Vst html" | w! /tmp/test.html | :q | !open /tmp/test.html

and you call the conversion pipeline from vim using new 'RP' command (RestPreview):

:RP
Was it helpful?

Solution

I would imagine this would be as simple as:

:com RP :exec "Vst html" | exe "w! " . $TMP . "/test.html" | :q | exe "silent !cmd /c start " . $TMP . "\\test.html"

Having said that, I'm not sure why :exec is used for running Vst, wouldn't this work?

:com RP Vst html | exe "w! " . $TMP . "/test.html" | :q | exe "silent !cmd /c start " . $TMP . "\\test.html"

I don't have the Vst plugin installed though, so I can't test this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top