1
1
*pandoc.txt* For Vim version 7.3 Last change: 2011 Aug 28
2
2
3
- # Vim Plugin for Pandoc | * pandoc*
3
+ Vim Plugin for *pandoc*
4
+ =======================
4
5
5
6
This is a bundle for writing and editing documents in [pandoc] []'s
6
- [ extended markdown] [ ] .
7
+ [extended markdown][]. It provides
7
8
8
- This documentation is only nominally formatted as a vim help file;
9
- really it is just markdown with a few vim help file tags between
10
- asterisks. (Someone want to write a vim-help writer module for pandoc?)
9
+ - some settings to make vim a pleasant | pandoc-writing-environment | ,
10
+ - | pandoc-syntax-highlighting | , with support for pandoc's extended
11
+ markdown,
12
+ - | pandoc-snippets | for use with snipMate,
13
+ - | pandoc-section-folding | ,
14
+ - | pandoc-citation-completion | ,
15
+ - some simple | pandoc-conversion-functions | and | pandoc-tidying-functions | ,
16
+ - a few | pandoc-localleader-mappings |
11
17
12
- In addition to reading this help file, you might take a look at the
13
- heavily commented ftplugin/pandoc.vim file.
18
+ *pandoc-writing-enviroment*
19
+ ===========================
14
20
15
- ## Known Gotchas
21
+ The bundle sets the following options, in an effort to provide a pleasant writing environment:
16
22
17
- 1 . Filetype detection does not play well with the [ markdown-vim plugin] [ ] .
18
-
19
- 2 . Filetype detection is aggressive: we assume that if you use this plugin,
20
- then you want to use pandoc for you markdown needs. So we match the
21
- following extensions: .markdown, .md, .mkd, .pd, .pdk, .pandoc, and .text.
23
+ setlocal linebreak
24
+ setlocal breakat-=*
22
25
23
- ## Maintainers
26
+ `linebreak ` tells vim to break lines at word boundaries. `breakat -= * `
27
+ expands vim's sense of a word boundary to handle markdown `* emphasis* ` .
24
28
25
- + [ Felipe Morales] ( https://github.com/fmoralesc/ )
26
- + [ David Sanson] ( https://github.com/dsanson/ )
29
+ nnoremap <buffer> j gj
30
+ nnoremap <buffer> k gk
31
+ vnoremap <buffer> j gj
32
+ vnoremap <buffer> k gk
27
33
28
- Thanks also to [ Wei Dai] [ ] for bug fixes and improvements.
34
+ These mappings allow use of j and k to move up and down in the middle of
35
+ a soft-wrapped line.
29
36
30
- ## Stuff From Elsewhere
37
+ setlocal display=lastline
31
38
32
- The syntax file was originally by jeremy schultz (found [ here ] [ ] ) as
33
- githubbed by [ wunki ] [ ] .
39
+ If you are using soft-wrapped line, this will tell vim to go ahead and
40
+ show part of a long line that runs off the bottom of the screen .
34
41
35
- The snippets file, for use with [ snipMate] [ ] , is a slight extension (and
36
- contraction) of the markdown.snippets file that is part of many of the
37
- [ vim-markdown repositories on github] [ ] .
42
+ setlocal nojoinspaces
38
43
39
- Autocompletion was implemented by hacking away at [ LaTeX Box] [ ] 's
40
- implementation of bibtex citation completion, even if the results don't
41
- look much like the original.
44
+ allows you to use CTRL-J to join the next line with the current line
45
+ without adding extra unwanted spaces.
42
46
43
- ## Features
47
+ setlocal commentstring=<!--%s-->
48
+ setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
44
49
45
- Here are some key features:
50
+ tells vim that, in your markdown files, use HTML-style commenting.
46
51
47
- - Applies settings to make vim a pleasant writing environment.
48
- - soft/hard word wrapping (configurable)
49
- - intelligent line joining
50
- - pandoc-powered tidying up
51
- - other little tweaks along these lines
52
+ *pandoc-hard-wrapping*
53
+ ----------------------
52
54
53
- Specifically:
55
+ By default, the bundle assumes that you will be using soft wrapping, and
56
+ applies
54
57
55
58
setlocal formatoptions=1
56
- setlocal linebreak
57
- nnoremap <buffer> j gj
58
- nnoremap <buffer> k gk
59
- vnoremap <buffer> j gj
60
- vnoremap <buffer> k gk
61
- setlocal display=lastline
62
- setlocal nojoinspaces
63
- setlocal commentstring=<!--%s-->
64
- setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
65
59
66
- Additional tweaks welcome. Feedback also welcome on whether this is
67
- appropriate. It would be easy to make some or all of this optional.
60
+ If you prefer hard wrapping, set g:pandoc_use_hard_wraps, i.e., put
61
+ something like
62
+
63
+ let g:pandoc_use_hard_wraps = 1
64
+
65
+ in your vimrc. When that is set, the bundle instead sets
66
+
67
+ setlocal formatoptions=qct
68
68
69
- Hard word wrapping can be used by setting ` g:pandoc_use_hard_wraps ` to 1
70
- in the .vimrc. It will set ` formatoptions ` to ` qct ` instead of ` 1 ` .
69
+ If you also want autoformatting, set g:pandoc_auto_format:
71
70
72
- - Syntax highlighting with support for definition lists, numbered
73
- examples, delimited code blocks, LaTeX and HTML, citations,
74
- footnotes, ....
71
+ let g:pandoc_auto_format = 1
75
72
76
- - Some snippets for use with snipMate (David says: I never use these,
77
- so they could probably use improvement. If you improve them, let
78
- us know).
73
+ in your vimrc. (Note that autoformatting can slow things down.)
79
74
80
- - Folding of sections. (See ` :help fold-commands ` if you haven't used
81
- vim's folding before.). Quick tips:
75
+ *pandoc-syntax-highlighting*
76
+ ============================
82
77
83
- - ` za ` toggles folds open and closed (` zA ` toggles fold and all
84
- its children open and closed)
85
- - ` zc ` closes a fold (` zC ` closes it and all its children)
86
- - ` zo ` opens a fold (` zO ` opens it and all its children).
78
+ The syntax highlighting should be fairly accurate and complete. By
79
+ default, the bundle tries to be smart, and only highlight implicit links
80
+ if there is a matching link definition. This can be expensive on large
81
+ files and slow things down. To disable it, set
82
+ g:pandoc_no_empty_implicits:
87
83
88
- - Autocompletion of citations (more details below).
84
+ let g:pandoc_no_empty_implicits = 1
89
85
90
- - Some simple pandoc-powered conversion and tidying functions.
86
+ *pandoc-snippets*
87
+ =================
91
88
92
- ftplugin/pandoc.vim is fairly well-commented. Take a look at it to see
93
- what it does in detail.
89
+ If you use snipMate, take a look at snippets/pandoc.snippets to see what
90
+ is available. One nice example: at the start of a document, type
91
+ `%% <TAB> ` to generate a title block, with the filename as title, the
92
+ value of `g: snips- author` as author, and the current date.
94
93
95
- ## Citation Autocompletion | * pandoc-citation-completion*
94
+ *pandoc-section-folding*
95
+ ========================
96
+
97
+ The bundle tells vim to fold documents by section. If you haven't used
98
+ folding before, see | fold-commands | . When used with [FoldList] [] this
99
+ also provides a handy navigable outline view of your document.
100
+
101
+ But folding can slow things down. To disable it, set
102
+ g:pandoc_no_folding:
103
+
104
+ let g:pandoc_no_folding = 1
105
+
106
+ *pandoc-citation-completion*
107
+ ============================
96
108
97
109
If you have a bibtex file (or a symlink to a bibtex file) named
98
110
'default.bib' in one of these folders,
@@ -102,17 +114,17 @@ If you have a bibtex file (or a symlink to a bibtex file) named
102
114
~/texmf/bibtex/bib
103
115
104
116
then the plugin will automatically use that file for citation
105
- autocompletion. If you define ` g:PandocBibfile ` in your vimrc,
117
+ completion. Or, set g:pandoc_bibfile:
106
118
107
- let g:PandocBibfile = '/the/path/to/your/bibtex/file.bib'
119
+ let g:pandoc_bibfile = '/the/path/to/your/bibtex/file.bib'
108
120
109
- then that file will be used instead .
121
+ to use your preferred file .
110
122
111
- To use autocompletion , start typing a citekey, e.g.,
123
+ To use completion , start typing a citekey, e.g.,
112
124
113
125
@geac
114
126
115
- and then, while still in insert mode, hit ctrl-x ctrl-o (vim's shortcut
127
+ and then, while still in insert mode, hit CTRL-X CTRL-O (vim's shortcut
116
128
for omnicompletion), and you'll get a popup window with a list of
117
129
matching keys, e.g.,
118
130
@@ -132,43 +144,27 @@ will want something like this in your vimrc:
132
144
let g:SuperTabDefaultCompletionType = "context"
133
145
134
146
Then you can just hit TAB in the middle of typing a citation
135
- to autocomplete the citation.
147
+ to complete the citation.
136
148
137
149
> **KNOWN BUGS**:
138
150
>
139
- > - SuperTab autocompletion of citations only works after you use ctrl-x
140
- > ctrl-o autocompletion once within a given file.
151
+ > - SuperTab completion of citations only works after you use ctrl-x
152
+ > ctrl-o completion once within a given file.
141
153
> - Regular expressions don't work when using SuperTab.
142
154
143
155
> **TODO**: pandoc.vim should be smarter about finding bibliography
144
156
> files. This includes:
145
157
>
158
+ > - borrowing settings from latex plugins, if present
146
159
> - finding the local texmf tree programatically
147
160
> - using (all?) bibtex files found in any of the search paths
148
161
> - including the directory that the file is in among the search paths
149
- > - better support for other bibliography database formats (the parser
150
- > currently works with bibtex and MODS xml files, but the script
151
- > doesn't look for MODS xml files)
152
-
153
- ## Configuration
162
+ > - better support for other bibliography database formats
154
163
155
- Some global variables can modify the plugin's behaviour and performance:
164
+ *pandoc-citation-dictionary*
165
+ ----------------------------
156
166
157
- 1 . As mentioned before, soft or hard wrapping can be set with the
158
- ` g:pandoc_use_hard_wraps ` variable set to 1.
159
- If desired when using hard wrapping, vim-pandoc will activate
160
- autoformatting is ` g:pandoc_auto_format ` is set to 1. Note that this can be
161
- slow.
162
-
163
- 2 . Folding can be disabled by setting ` g:pandoc_no_folding ` to 1. This can
164
- improve performance.
165
-
166
- 3 . Highlighting of empty implicit links can be expensive on large files. To
167
- disable it, set ` g:pandoc_no_empty_implicits ` to 1.
168
-
169
- ## Dictionary-Based Citation Completions
170
-
171
- We are leaving this in for now, but now that proper autocompletion is
167
+ We are leaving this in for now, but now that proper completion is
172
168
working, we'll probably get rid of it. If you create a text file,
173
169
`
174
170
~/.pandoc/citationkeys.dict
@@ -187,21 +183,55 @@ autocompletion by typing part of a citekey, e.g.,
187
183
188
184
@adams19
189
185
190
- and then hitting ctrl-x ctrl-k (or via SuperTab).
186
+ and then hitting CTRL-X CTRL-K (or via SuperTab).
191
187
192
- ## Conversion and Tidying Up | * MarkdownTidy* * MarkdownTidyWrap* * PandocHtmlOpen* * PandocPdfOpen* * PandocOdtOpen*
188
+ *pandoc-conversion-functions*
189
+ =============================
193
190
194
- Look at the comments in ftpugin/pandoc.vim to see what is there . We've
195
- made no attempt to provide a complete set of commands, since it is easy
196
- to do something like
191
+ Pandoc can be used to perform lots of different conversions . We've
192
+ made no attempt to provide functions that cover all these possibilities,
193
+ since it is easy to do something like
197
194
198
195
:!markdown2pdf %
199
196
200
197
If there is a particular conversion that you do all the time with a
201
198
particular set of options, you might want to define a leader mapping
202
199
in your vimrc.
203
200
204
- The plugin sets
201
+ *PandocHtmlOpen*, *PandocPdfOpen* and *PandocOdtOpen*
202
+ -----------------------------------------------------
203
+
204
+ We currently provide three convert-and-open functions. When you run *PandocPdfOpen*, for example, the file in the current buffer is converted to PDF and then opened in your default PDF viewer. (Linux users: these commands depend on xdg-open.)
205
+
206
+ If you have defined maplocalleader in your vimrc, e.g.,
207
+
208
+ let maplocalleader = ","
209
+
210
+ then we will define localleader mappings for each of these commands:
211
+
212
+ <localleader> pdf
213
+ <localleader> odt
214
+ <localleader> html
215
+
216
+ So then you can type something like `,pdf` and a PDF version of your current buffer will be displayed.
217
+
218
+ *pandoc-tidying-functions*
219
+ ==========================
220
+
221
+ The plugin defines two functions designed for tidying up your markdown:
222
+ *MarkdownTidy* and *MarkdownTidyWrap*. Running MarkdownTidyWrap is
223
+ equivalent to
224
+
225
+ :%!pandoc -t markdown -s
226
+
227
+ Note that this can have some unexpected effects: it will replace all of
228
+ your reference link ids with implicit reference links; it will replace
229
+ all of your footnote ids with numbers; it will transform any setext
230
+ style headers into atx style headers; it will process any latex macros
231
+ you may have defined and delete the macro definitions; if your document
232
+ lacks a title block, it will add one.
233
+
234
+ The plugin also sets
205
235
206
236
setlocal equalprg=pandoc\ -t\ markdown\ --reference-links
207
237
@@ -211,47 +241,55 @@ this to
211
241
212
242
setlocal equalprg=pandoc\ -t\ markdown\ --reference-links\ --no-wrap
213
243
214
- Either way, there are a few gotchas to be aware of:
244
+ Note that this will *remove* any title block, as well as processing any
245
+ custom latex macros. So you might not want to `ggvG= ` .
215
246
216
- 1 . The filter will remove pandoc's title block, if that is included in
217
- the chunk of filtered text.
218
- 2 . The filter will apply and remove any latex macros you might have
219
- defined, if they are included in the chunk of filtered text.
247
+ Maintainers
248
+ ===========
220
249
221
- So keep your metadata and macros at the top of the file, and avoid
222
- filtering them with ` = ` .
250
+ + [Felipe Morales]( https://github.com/fmoralesc/ )
251
+ + [David Sanson]( https://github.com/dsanson/ )
223
252
224
- If you know how to work around these problems, let us know (or better,
225
- fork and fix it).
253
+ Thanks also to [Wei Dai][] for bug fixes and improvements.
226
254
227
- ## LocalLeader Mappings | * pandoc-local-leader-mappings*
255
+ Borrowings
256
+ ==========
228
257
229
- If you define maplocalleader in your vimrc,
258
+ The syntax file was originally by jeremy schultz (found [here] []) as
259
+ githubbed by [wunki] [].
230
260
231
- let maplocalleader = ","
261
+ The snippets file, for use with [snipMate] [], is a slight extension (and
262
+ contraction) of the markdown.snippets file that is part of many of the
263
+ [vim-markdown repositories on github][].
232
264
233
- then the plugin will define some leader mappings for you. For example,
265
+ Autocompletion was implemented by hacking away at [LaTeX Box][]'s
266
+ implementation of bibtex citation completion, even if the results don't
267
+ look much like the original.
234
268
235
- <localleader>pdf
236
- <localleader>odt
237
- <localleader>html
269
+ Known Issues
270
+ ============
271
+
272
+ 1. Filetype detection does not play well with the [markdown-vim plugin][].
273
+
274
+ 2. Filetype detection is aggressive: we assume that if you use this plugin,
275
+ then you want to use pandoc for you markdown needs. So we match the
276
+ following extensions: .markdown, .md, .mkd, .pd, .pdk, .pandoc, and .text.
238
277
239
- which convert the buffer to given format and open the results.
240
278
241
279
* * * *
242
280
243
281
[pandoc] : http://johnmacfarlane.net/pandoc/
244
282
[extended markdown]: http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
245
283
[markdown-vim plugin]: http://plasticboy.com/markdown-vim-mode/
246
- [ Felipe Morales ] : https://github.com/fmoralesc
247
284
[Wei Dai]: https://github.com/clvv
248
285
[here] : http://www.vim.org/scripts/script.php?script_id=2389
249
286
[wunki] : https://github.com/wunki/vim-pandoc
250
287
[snipMate] : http://www.vim.org/scripts/script.php?script_id=2540
251
288
[vim-markdown repositories on github]: https://github.com/hallison/vim-markdown
252
289
[LaTeX Box]: http://www.vim.org/scripts/script.php?script_id=3109
253
290
[SuperTab] : http://www.vim.org/scripts/script.php?script_id=1643
291
+ [FoldList] : http://www.vim.org/scripts/script.php?script_id=500
292
+
254
293
294
+ vim:tw=78:ts=8:ft=help:norl:
255
295
256
- <!-- vim:tw=78:ts=8:ft=pandoc:norl:
257
- -->
0 commit comments