forked from previm/previm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
previm.txt
232 lines (163 loc) · 6.25 KB
/
previm.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
*previm.txt* Preview Plugin
Version: 1.6
Author: kanno <[email protected]>
==============================================================================
CONTENTS *previm-contents*
Introduction |previm-introduction|
Dependencies |previm-depends|
Usage |previm-usage|
Commands |previm-command|
Functions |previm-functions|
Settings |previm-settings|
Using with open-browser.vim |previm-openbrowser|
Changelog |previm-changelog|
==============================================================================
INDRODUCTION *previm-introduction*
This plugin provides the functionality of displaying file previews on
browsers. It achieves something similar to real-time previewing.
[Available formats]
- Markdown
- textile
- reStructuredText(required rst2html.py)
Latest revision:
http://github.com/kannokanno/previm
==============================================================================
DEPENDENCIES *previm-depends*
[Required]
None
[Optional]
- open-browser.vim(https://github.com/tyru/open-browser.vim)
==============================================================================
USAGE *previm-usage*
This is an example of the case of markdown.
The basic operation is the same in other formats.
1. Set |g:previm_open_cmd| in your .vimrc. This is unnecessary if you are using
open-browser.vim.
2. Start editing a file with |filetype| of Markdown.
3. Open preview on browser with |:PrevimOpen|.
4. Go back to the buffer and edit some more.
5. Changes are reflected on the page shown in the browser each update.
Note: If `.md` files are recognized as `modula2` rather than `markdown`, add
the following to your .vimrc.
" .vimrc
augroup PrevimSettings
autocmd!
autocmd BufNewFile,BufRead *.{md,mdwn,mkd,mkdn,mark*} set filetype=markdown
augroup END
==============================================================================
COMMANDS *previm-command*
*:PrevimOpen*
:PrevimOpen
Opens the current file on the browser.
==============================================================================
FUNCTIONS *previm-functions*
previm#open({path}) *previm#open()*
Set {path} to the URL to open in browser.
previm#refresh() *previm#refresh()*
Apply the changes made to the file. This will automatically update
the page shown in the browser.
==============================================================================
SETTINGS *previm-settings*
g:previm_open_cmd *g:previm_open_cmd*
Type:String
Specify the command to be executed with |:PrevimOpen|. openbrowser#open
is executed if no command is specified.
Also see |previm-openbrowser|.
The following sample configuration opens Firefox on Mac.
>
" .vimrc
let g:previm_open_cmd = 'open -a Firefox'
g:previm_enable_realtime *g:previm_enable_realtime*
Type:Num
You can select whether you want to preview the changes in real time.
Changes are reflected only at the timing if the value 0.
* When saving a file
If the value is 1, I can preview in near real-time.
It is set to 0 by default.
The case of changing this value after opening a file to preview is
You need to re-open the file to preview in order to reflect the setting.
>
" .vimrc
" Realtime preview
let g:previm_enable_realtime = 1
g:previm_disable_default_css *g:previm_disable_default_css*
Type:Num
I do not apply the default CSS when previewing.
Valid values that can be set only one. All other values are ignored.
>
" .vimrc
" I want to disable the default CSS
let g:previm_disable_default_css = 1
g:previm_custom_css_path *g:previm_custom_css_path*
Type:String
I can add a custom CSS during preview.
This CSS will be loaded after the default CSS.
Please write the absolute path to the CSS file to the set value.
>
" .vimrc
" Also apply your own CSS in addition to the default CSS
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
" .vimrc
" Instead of using the default CSS and apply only your own CSS
let g:previm_disable_default_css = 1
let g:previm_custom_css_path = '/Users/kanno/tmp/some.css'
g:previm_show_header *g:previm_show_header*
Type:Num
If the value is 1, it will display a header at the time of preview.
The header displays the file name and update datetime that you are editing.
If the value is 0, it does not display the header at the time of preview.
It is set to 1 by default.
>
" .vimrc
let g:previm_show_header = 0
==============================================================================
USING WITH OPEN-BROWSER.VIM *previm-openbrowser*
The following steps are taken for choosing which browser to display the
preview on.
1. Attempt to execute command that is set to |g:previm_open_cmd|
- If |g:previm_open_cmd| is undefined or empty, proceed to step 2
2. Attempt open browser with openbrowser#open()
- If open-browser.vim is not installed, proceed to step 3
3. Exit after displaying message to standard error about not being able to
find any command to execute.
Thus, |g:previm_open_cmd| need not be configured when using open-browser.vim.
==============================================================================
CHANGELOG *previm-changelog*
1.7.1 2015-08-17
- support hidden header
1.7 2015-08-15
- support mermaid(https://github.com/knsv/mermaid)
1.6 2014-09-15
- support realtime refresh
1.5.4 2014-09-06
- support custom css
1.5.3 2014-08-02
- support reStructuredText(required rst2html.py)
1.5.2 2014-07-27
- code block syntax highlighting
- update marked.js
1.5.1 2014-06-08
- fix bug regarding css
1.5 2014-04-05
- add notice about modula2
1.4 2014-03-29
- add support for textile
1.3.2 2013-07-06
- local images can now be referenced
- fix bug when g:previm_open_cmd contains half-width space character
1.3.1 2013-06-28
- change showdown.js to "marked"
1.3 2013-06-22
- fixed #4(Github issue)
- escape Windows' directory path
- add support for browsers before IE8 (add support for attachEvent)
- add feature to display modified time under Windows environment
- Thanks id:sousu, id:beckorz
1.2 2013-06-16
- resolved reload issue in google chrome
- Thanks id:ArcCosine
1.1 2013-06-13
- explicitly state the usage of UTF-8 encoding in previm-function.js
1.0 2013-06-11
- first release
vim:tw=78:ts=8:ft=help:norl:noexpandtab