Skip to content

Commit c13993b

Browse files
committed
Folding and empty implicits highlighting can be disabled if needed for performance reasons.
Updated documentation.
1 parent 6e1404c commit c13993b

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

doc/pandoc.txt

+17-1
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,27 @@ to autocomplete the citation.
150150
> currently works with bibtex and MODS xml files, but the script
151151
> doesn't look for MODS xml files)
152152
153+
## Configuration
154+
155+
Some global variables can modify the plugin's behaviour and performance:
156+
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+
153169
## Dictionary-Based Citation Completions
154170

155171
We are leaving this in for now, but now that proper autocompletion is
156172
working, we'll probably get rid of it. If you create a text file,
157-
173+
`
158174
~/.pandoc/citationkeys.dict
159175

160176
that contains a list of citation keys, one per line, like so

ftplugin/pandoc.vim

+4-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
5757
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
5858
" # Folding sections with ATX style headers.
5959
"
60-
setlocal foldexpr=MarkdownLevel()
61-
setlocal foldmethod=expr
60+
if !exists("g:pandoc_no_folding") || !g:pandoc_no_folding
61+
setlocal foldexpr=MarkdownLevel()
62+
setlocal foldmethod=expr
63+
endif
6264

6365
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
6466
" # Use ctrl-X ctrl-K for dictionary completions.

plugin/pandoc.vim

+4-2
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,10 @@ endfunction
219219
"
220220
" FM: I recommend `viewoptions` set to "folds,cursor" only.
221221
"
222-
autocmd BufWinLeave * if expand(&filetype) == "pandoc" | mkview | endif
223-
autocmd BufWinEnter * if expand(&filetype) == "pandoc" | loadview | endif
222+
if !exists("g:pandoc_no_folding") || !g:pandoc_no_folding
223+
autocmd BufWinLeave * if expand(&filetype) == "pandoc" | mkview | endif
224+
autocmd BufWinEnter * if expand(&filetype) == "pandoc" | loadview | endif
225+
endif
224226

225227
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
226228
" 3. Completion

syntax/pandoc.vim

+4-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ syn match pandocLinkURL /https\{0,1}:.\{-}\()\|\s\|\n\)\@=/ containedin=pandocLi
125125
syn match pandocAutomaticLink /<\(https\{0,1}.\{-}\|.\{-}@.\{-}\..\{-}\)>/
126126
syn match pandocLinkTextRef /\(\]\(\[\|(\)\)\@<=.\{-}\(\]\|)\)\@=/ containedin=pandocLinkText contained
127127
syn match pandocLinkTitle /".\{-}"/ contained containedin=pandocLinkArea contains=@Spell
128-
128+
" This can be expensive on very lalrge files, so we should be able to disable
129+
" it:
130+
if !exists("g:pandoc_no_empty_implicits") || !g:pandoc_no_empty_implicits
129131
" will highlight implicit references only if, on reading the file, it can find
130132
" a matching reference label. This way, square parenthesis in a file won't be
131133
" highlighted unless they will be turned into links by pandoc.
@@ -149,7 +151,7 @@ for line in vim.current.buffer:
149151
regex = "\(" + r"\|".join(["\[" + label + "\]" for label in labels]) + "\)"
150152
vim.command("syn match pandocLinkArea /" + regex + r"[ \.,;\t\n-]\@=/")
151153
EOF
152-
154+
endif
153155
"""""""""""""""""""""""""""""""""""""""
154156
" Strong:
155157
"

0 commit comments

Comments
 (0)