Preview RestructuredText with firefox when editing in vim on ms-windows

I want to use VIM to edit re-structured text documents on multiple operating systems.

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

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

Can I also use an environment variable to indicate the location of a temporary 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
+3
source share
1 answer

I would suggest that it will 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 it is :execused to start Vst, will this not work?

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

I do not have the Vst plugin installed, so I cannot verify this.

+2
source

Source: https://habr.com/ru/post/1715697/


All Articles