Skip to content

Commit fe8505d

Browse files
committed
improving README
1 parent 1268bc1 commit fe8505d

File tree

1 file changed

+157
-119
lines changed

1 file changed

+157
-119
lines changed

doc/pandoc.txt

+157-119
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,110 @@
11
*pandoc.txt* For Vim version 7.3 Last change: 2011 Aug 28
22

3-
# Vim Plugin for Pandoc | *pandoc*
3+
Vim Plugin for *pandoc*
4+
=======================
45

56
This is a bundle for writing and editing documents in [pandoc][]'s
6-
[extended markdown][].
7+
[extended markdown][]. It provides
78

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|
1117

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+
===========================
1420

15-
## Known Gotchas
21+
The bundle sets the following options, in an effort to provide a pleasant writing environment:
1622

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-=*
2225

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*`.
2428

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
2733

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.
2936

30-
## Stuff From Elsewhere
37+
setlocal display=lastline
3138

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.
3441

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
3843

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.
4246

43-
## Features
47+
setlocal commentstring=<!--%s-->
48+
setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
4449

45-
Here are some key features:
50+
tells vim that, in your markdown files, use HTML-style commenting.
4651

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+
----------------------
5254

53-
Specifically:
55+
By default, the bundle assumes that you will be using soft wrapping, and
56+
applies
5457

5558
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:-->
6559

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
6868

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:
7170

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
7572

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.)
7974

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+
============================
8277

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:
8783

88-
- Autocompletion of citations (more details below).
84+
let g:pandoc_no_empty_implicits = 1
8985

90-
- Some simple pandoc-powered conversion and tidying functions.
86+
*pandoc-snippets*
87+
=================
9188

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.
9493

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+
============================
96108

97109
If you have a bibtex file (or a symlink to a bibtex file) named
98110
'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
102114
~/texmf/bibtex/bib
103115

104116
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:
106118

107-
let g:PandocBibfile = '/the/path/to/your/bibtex/file.bib'
119+
let g:pandoc_bibfile = '/the/path/to/your/bibtex/file.bib'
108120

109-
then that file will be used instead.
121+
to use your preferred file.
110122

111-
To use autocompletion, start typing a citekey, e.g.,
123+
To use completion, start typing a citekey, e.g.,
112124

113125
@geac
114126

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
116128
for omnicompletion), and you'll get a popup window with a list of
117129
matching keys, e.g.,
118130

@@ -132,43 +144,27 @@ will want something like this in your vimrc:
132144
let g:SuperTabDefaultCompletionType = "context"
133145

134146
Then you can just hit TAB in the middle of typing a citation
135-
to autocomplete the citation.
147+
to complete the citation.
136148

137149
> **KNOWN BUGS**:
138150
>
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.
141153
> - Regular expressions don't work when using SuperTab.
142154

143155
> **TODO**: pandoc.vim should be smarter about finding bibliography
144156
> files. This includes:
145157
>
158+
> - borrowing settings from latex plugins, if present
146159
> - finding the local texmf tree programatically
147160
> - using (all?) bibtex files found in any of the search paths
148161
> - 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
154163

155-
Some global variables can modify the plugin's behaviour and performance:
164+
*pandoc-citation-dictionary*
165+
----------------------------
156166

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
172168
working, we'll probably get rid of it. If you create a text file,
173169
`
174170
~/.pandoc/citationkeys.dict
@@ -187,21 +183,55 @@ autocompletion by typing part of a citekey, e.g.,
187183

188184
@adams19
189185

190-
and then hitting ctrl-x ctrl-k (or via SuperTab).
186+
and then hitting CTRL-X CTRL-K (or via SuperTab).
191187

192-
## Conversion and Tidying Up | *MarkdownTidy* *MarkdownTidyWrap* *PandocHtmlOpen* *PandocPdfOpen* *PandocOdtOpen*
188+
*pandoc-conversion-functions*
189+
=============================
193190

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
197194

198195
:!markdown2pdf %
199196

200197
If there is a particular conversion that you do all the time with a
201198
particular set of options, you might want to define a leader mapping
202199
in your vimrc.
203200

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
205235

206236
setlocal equalprg=pandoc\ -t\ markdown\ --reference-links
207237

@@ -211,47 +241,55 @@ this to
211241

212242
setlocal equalprg=pandoc\ -t\ markdown\ --reference-links\ --no-wrap
213243

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=`.
215246

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+
===========
220249

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/)
223252

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.
226254

227-
## LocalLeader Mappings | *pandoc-local-leader-mappings*
255+
Borrowings
256+
==========
228257

229-
If you define maplocalleader in your vimrc,
258+
The syntax file was originally by jeremy schultz (found [here][]) as
259+
githubbed by [wunki][].
230260

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][].
232264

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.
234268

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.
238277

239-
which convert the buffer to given format and open the results.
240278

241279
* * * *
242280

243281
[pandoc]: http://johnmacfarlane.net/pandoc/
244282
[extended markdown]: http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
245283
[markdown-vim plugin]: http://plasticboy.com/markdown-vim-mode/
246-
[Felipe Morales]: https://github.com/fmoralesc
247284
[Wei Dai]: https://github.com/clvv
248285
[here]: http://www.vim.org/scripts/script.php?script_id=2389
249286
[wunki]: https://github.com/wunki/vim-pandoc
250287
[snipMate]: http://www.vim.org/scripts/script.php?script_id=2540
251288
[vim-markdown repositories on github]: https://github.com/hallison/vim-markdown
252289
[LaTeX Box]: http://www.vim.org/scripts/script.php?script_id=3109
253290
[SuperTab]: http://www.vim.org/scripts/script.php?script_id=1643
291+
[FoldList]: http://www.vim.org/scripts/script.php?script_id=500
292+
254293

294+
vim:tw=78:ts=8:ft=help:norl:
255295

256-
<!-- vim:tw=78:ts=8:ft=pandoc:norl:
257-
-->

0 commit comments

Comments
 (0)