2009-08-21 62 views
3

我想在許多操作系統中使用VIM編輯重建的文本文檔。使用firefox預覽RestructuredText,同時在ms-windows上編輯vim

我發現這個張貼http://www.zopyx.com/blog/editing-restructuredtext-with-vim

你能幫我拿出線時,MS-Windows操作系統上運行,以達到同樣的效果?

也可以使用環境變量來指定臨時文件的位置嗎?

 
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 

回答

2

我會想象,因爲這將是非常簡單的:

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

說了這麼多,我不知道爲什麼:exec用於運行VST,不這項工作?

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

雖然我沒有安裝Vst插件,所以我無法測試這個。

+0

第一行有效,第二行不行。謝謝你的幫助。 – 2009-08-21 10:07:11

+0

@Rudiger:我想在這種情況下Vst不是用'-bar'選項定義的,它可以讓其他命令跟隨它。這將解釋需要使用':exe'。 – DrAl 2009-08-21 10:27:16