All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 *vim-markdown* Vim Markdown
3 ===============================================================================
6 1. Introduction |vim-markdown-introduction|
7 2. Installation |vim-markdown-installation|
8 3. Basic usage |vim-markdown-basic-usage|
9 1. Folding |vim-markdown-folding|
10 2. Concealing |vim-markdown-concealing|
11 4. Options |vim-markdown-options|
12 1. Disable Folding |vim-markdown-disable-folding|
13 2. Change fold style |vim-markdown-change-fold-style|
14 3. Set header folding level |vim-markdown-set-header-folding-level|
15 4. Disable Default Key Mappings |vim-markdown-disable-default-key-mappings|
16 5. Enable TOC window auto-fit |vim-markdown-enable-toc-window-auto-fit|
17 6. Text emphasis restriction to single-lines
18 |vim-markdown-text-emphasis-restriction-to-single-lines|
19 7. Syntax Concealing |vim-markdown-syntax-concealing|
20 8. Fenced code block languages |vim-markdown-fenced-code-block-languages|
21 9. Follow named anchors |vim-markdown-follow-named-anchors|
22 10. Syntax extensions |vim-markdown-syntax-extensions|
23 1. LaTeX math |vim-markdown-latex-math|
24 2. YAML Front Matter |vim-markdown-yaml-front-matter|
25 3. TOML Front Matter |vim-markdown-toml-front-matter|
26 4. JSON Front Matter |vim-markdown-json-front-matter|
27 5. Strikethrough |vim-markdown-strikethrough|
28 11. Adjust new list item indent |vim-markdown-adjust-new-list-item-indent|
29 12. Do not require .md extensions for Markdown links
30 |vim-markdown-do-not-require-.md-extensions-for-markdown-links|
31 13. Auto-write when following link
32 |vim-markdown-auto-write-when-following-link|
33 14. Change default file extension
34 |vim-markdown-change-default-file-extension|
35 15. Do not automatically insert bulletpoints
36 |vim-markdown-do-not-automatically-insert-bulletpoints|
37 16. Change how to open new files |vim-markdown-change-how-to-open-new-files|
38 5. Mappings |vim-markdown-mappings|
39 6. Commands |vim-markdown-commands|
40 7. Credits |vim-markdown-credits|
41 8. License |vim-markdown-license|
42 9. References |vim-markdown-references|
44 ===============================================================================
45 *vim-markdown-introduction*
48 Syntax highlighting, matching rules and mappings for the original Markdown [1]
51 ===============================================================================
52 *vim-markdown-installation*
55 If you use Vundle [2], add the following lines to your '~/.vimrc':
57 Plugin 'godlygeek/tabular'
58 Plugin 'preservim/vim-markdown'
60 The 'tabular' plugin must come _before_ 'vim-markdown'.
67 If you use Pathogen [3], do this:
70 git clone https://github.com/preservim/vim-markdown.git
72 To install without Pathogen using the Debian vim-addon-manager [4], do this:
74 git clone https://github.com/preservim/vim-markdown.git
77 vim-addon-manager install markdown
79 If you are not using any package manager, download the tarball [5] and do this:
82 tar --strip=1 -zxf vim-markdown-master.tar.gz
84 ===============================================================================
85 *vim-markdown-basic-usage*
88 -------------------------------------------------------------------------------
89 *vim-markdown-folding*
92 Folding is enabled for headers by default.
94 The following commands are useful to open and close folds:
97 - 'zr': reduces fold level throughout the buffer
99 - 'zR': opens all folds
101 - 'zm': increases fold level throughout the buffer
103 - 'zM': folds everything all the way
105 - 'za': toggle a fold your cursor is on
107 - 'zA': toggle a fold your cursor is on recursively
109 - 'zo': open a fold your cursor is on
111 - 'zO': open a fold your cursor is on recursively
113 - 'zc': close a fold your cursor is on
115 - 'zC': close a fold your cursor is on recursively
117 Options are available to disable folding or change folding style.
119 Try ':help fold-expr' and ':help fold-commands' for details.
121 -------------------------------------------------------------------------------
122 *vim-markdown-concealing*
125 Concealing is set for some syntax such as bold, italic, code block and link.
127 Concealing lets you conceal text with other text. The actual source text is not
128 modified. If you put your cursor on the concealed line, the conceal goes away.
130 Options are available to disable or change concealing.
132 Try ':help concealcursor' and ':help conceallevel' for details.
134 ===============================================================================
135 *vim-markdown-options*
138 -------------------------------------------------------------------------------
139 *vim-markdown-disable-folding*
142 *g:vim_markdown_folding_disabled*
143 - 'g:vim_markdown_folding_disabled'
145 Add the following line to your '.vimrc' to disable the folding
148 let g:vim_markdown_folding_disabled = 1
150 This option only controls Vim Markdown specific folding configuration.
152 To enable/disable folding use Vim's standard folding configuration.
156 -------------------------------------------------------------------------------
157 *vim-markdown-change-fold-style*
160 *g:vim_markdown_folding_style_pythonic*
161 - 'g:vim_markdown_folding_style_pythonic'
163 To fold in a style like python-mode [6], add the following to your
166 let g:vim_markdown_folding_style_pythonic = 1
168 'g:vim_markdown_folding_level' setting (default 1) is set to 'foldlevel'.
169 Thus level 1 heading which is served as a document title is expanded by
172 *g:vim_markdown_override_foldtext*
173 - 'g:vim_markdown_override_foldtext'
175 To prevent foldtext from being set add the following to your '.vimrc':
177 let g:vim_markdown_override_foldtext = 0
179 -------------------------------------------------------------------------------
180 *vim-markdown-set-header-folding-level*
181 Set header folding level ~
183 *g:vim_markdown_folding_level*
184 - 'g:vim_markdown_folding_level'
186 Folding level is a number between 1 and 6. By default, if not specified, it
189 let g:vim_markdown_folding_level = 6
191 Tip: it can be changed on the fly with:
193 :let g:vim_markdown_folding_level = 1
196 -------------------------------------------------------------------------------
197 *vim-markdown-disable-default-key-mappings*
198 Disable Default Key Mappings ~
200 *g:vim_markdown_no_default_key_mappings*
201 - 'g:vim_markdown_no_default_key_mappings'
203 Add the following line to your '.vimrc' to disable default key mappings:
205 let g:vim_markdown_no_default_key_mappings = 1
207 You can also map them by yourself with '<Plug>' mappings.
209 -------------------------------------------------------------------------------
210 *vim-markdown-enable-toc-window-auto-fit*
211 Enable TOC window auto-fit ~
213 *g:vim_markdown_toc_autofit*
214 - 'g:vim_markdown_toc_autofit'
216 Allow for the TOC window to auto-fit when it's possible for it to shrink.
217 It never increases its default size (half screen), it only shrinks.
219 let g:vim_markdown_toc_autofit = 1
221 -------------------------------------------------------------------------------
222 *vim-markdown-text-emphasis-restriction-to-single-lines*
223 Text emphasis restriction to single-lines ~
225 *g:vim_markdown_emphasis_multiline*
226 - 'g:vim_markdown_emphasis_multiline'
228 By default text emphasis works across multiple lines until a closing token
229 is found. However, it's possible to restrict text emphasis to a single line
230 (i.e., for it to be applied a closing token must be found on the same
233 let g:vim_markdown_emphasis_multiline = 0
235 -------------------------------------------------------------------------------
236 *vim-markdown-syntax-concealing*
239 *g:vim_markdown_conceal*
240 - 'g:vim_markdown_conceal'
242 Concealing is set for some syntax.
244 For example, conceal '[link text](link url)' as just 'link text'. Also,
245 '_italic_' and '*italic*' will conceal to just _italic_. Similarly
246 '__bold__', '**bold**', '___italic bold___', and '***italic bold***' will
247 conceal to just **bold**, **bold**, **_italic bold_**, and **_italic
248 bold_** respectively.
250 To enable conceal use Vim's standard conceal configuration.
254 To disable conceal regardless of 'conceallevel' setting, add the following
257 let g:vim_markdown_conceal = 0
259 To disable math conceal with LaTeX math syntax enabled, add the following
262 let g:tex_conceal = ""
263 let g:vim_markdown_math = 1
265 *g:vim_markdown_conceal_code_blocks*
266 - 'g:vim_markdown_conceal_code_blocks'
268 Disabling conceal for code fences requires an additional setting:
270 let g:vim_markdown_conceal_code_blocks = 0
272 -------------------------------------------------------------------------------
273 *vim-markdown-fenced-code-block-languages*
274 Fenced code block languages ~
276 *g:vim_markdown_fenced_languages*
277 - 'g:vim_markdown_fenced_languages'
279 You can use filetype name as fenced code block languages for syntax
280 highlighting. If you want to use different name from filetype, you can add
281 it in your '.vimrc' like so:
283 let g:vim_markdown_fenced_languages = ['csharp=cs']
285 This will cause the following to be highlighted using the 'cs' filetype
292 Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
294 -------------------------------------------------------------------------------
295 *vim-markdown-follow-named-anchors*
296 Follow named anchors ~
298 *g:vim_markdown_follow_anchor*
299 - 'g:vim_markdown_follow_anchor'
301 This feature allows the 'ge' command to follow named anchors in links of
302 the form 'file#anchor' or just '#anchor', where file may omit the '.md'
303 extension as usual. Two variables control its operation:
305 let g:vim_markdown_follow_anchor = 1
307 This tells vim-markdown whether to attempt to follow a named anchor in a
308 link or not. When it is 1, and only if a link can be split in two parts by
309 the pattern '#', then the first part is interpreted as the file and the
310 second one as the named anchor. This also includes urls of the form
311 '#anchor', for which the first part is considered empty, meaning that the
312 target file is the current one. After the file is opened, the anchor will
317 *g:vim_markdown_anchorexpr*
318 - 'g:vim_markdown_anchorexpr'
320 let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
322 This expression will be evaluated substituting 'v:anchor' with a quoted
323 string that contains the anchor to visit. The result of the evaluation will
324 become the real anchor to search in the target file. This is useful in
325 order to convert anchors of the form, say, 'my-section-title' to searches
326 of the form 'My Section Title' or '<<my-section-title>>'.
330 -------------------------------------------------------------------------------
331 *vim-markdown-syntax-extensions*
334 The following options control which syntax extensions will be turned on. They
337 -------------------------------------------------------------------------------
338 *vim-markdown-latex-math*
341 *g:vim_markdown_math*
342 - 'g:vim_markdown_math'
344 Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
346 let g:vim_markdown_math = 1
348 -------------------------------------------------------------------------------
349 *vim-markdown-yaml-front-matter*
352 *g:vim_markdown_frontmatter*
353 - 'g:vim_markdown_frontmatter'
355 Highlight YAML front matter as used by Jekyll or Hugo [7].
357 let g:vim_markdown_frontmatter = 1
359 -------------------------------------------------------------------------------
360 *vim-markdown-toml-front-matter*
363 *g:vim_markdown_toml_frontmatter*
364 - 'g:vim_markdown_toml_frontmatter'
366 Highlight TOML front matter as used by Hugo [7].
368 TOML syntax highlight requires vim-toml [8].
370 let g:vim_markdown_toml_frontmatter = 1
372 -------------------------------------------------------------------------------
373 *vim-markdown-json-front-matter*
376 *g:vim_markdown_json_frontmatter*
377 - 'g:vim_markdown_json_frontmatter'
379 Highlight JSON front matter as used by Hugo [7].
381 JSON syntax highlight requires vim-json [9].
383 let g:vim_markdown_json_frontmatter = 1
385 -------------------------------------------------------------------------------
386 *vim-markdown-strikethrough*
389 *g:vim_markdown_strikethrough*
390 - 'g:vim_markdown_strikethrough'
392 Strikethrough uses two tildes. '~~Scratch this.~~'
394 let g:vim_markdown_strikethrough = 1
396 -------------------------------------------------------------------------------
397 *vim-markdown-adjust-new-list-item-indent*
398 Adjust new list item indent ~
400 *g:vim_markdown_new_list_item_indent*
401 - 'g:vim_markdown_new_list_item_indent'
403 You can adjust a new list indent. For example, you insert a single line
408 Then if you type 'o' to insert new line in vim and type '* item2', the
414 vim-markdown automatically insert the indent. By default, the number of
415 spaces of indent is 4. If you'd like to change the number as 2, just write:
417 let g:vim_markdown_new_list_item_indent = 2
419 -------------------------------------------------------------------------------
420 *vim-markdown-do-not-require-.md-extensions-for-markdown-links*
421 Do not require .md extensions for Markdown links ~
423 *g:vim_markdown_no_extensions_in_markdown*
424 - 'g:vim_markdown_no_extensions_in_markdown'
426 If you want to have a link like this '[link text](link-url)' and follow it
427 for editing in vim using the 'ge' command, but have it open the file "link-
428 url.md" instead of the file "link-url", then use this option:
430 let g:vim_markdown_no_extensions_in_markdown = 1
432 This is super useful for GitLab and GitHub wiki repositories.
434 Normal behaviour would be that vim-markup required you to do this '[link
435 text](link-url.md)', but this is not how the Gitlab and GitHub wiki
436 repositories work. So this option adds some consistency between the two.
438 -------------------------------------------------------------------------------
439 *vim-markdown-auto-write-when-following-link*
440 Auto-write when following link ~
442 *g:vim_markdown_autowrite*
443 - 'g:vim_markdown_autowrite'
445 If you follow a link like this '[link text](link-url)' using the 'ge'
446 shortcut, this option will automatically save any edits you made before
449 let g:vim_markdown_autowrite = 1
451 -------------------------------------------------------------------------------
452 *vim-markdown-change-default-file-extension*
453 Change default file extension ~
455 *g:vim_markdown_auto_extension_ext*
456 - 'g:vim_markdown_auto_extension_ext'
458 If you would like to use a file extension other than '.md' you may do so
459 using the 'vim_markdown_auto_extension_ext' variable:
461 let g:vim_markdown_auto_extension_ext = 'txt'
463 -------------------------------------------------------------------------------
464 *vim-markdown-do-not-automatically-insert-bulletpoints*
465 Do not automatically insert bulletpoints ~
467 *g:vim_markdown_auto_insert_bullets*
468 - 'g:vim_markdown_auto_insert_bullets'
470 Automatically inserting bulletpoints can lead to problems when wrapping
471 text (see issue #232 for details), so it can be disabled:
473 let g:vim_markdown_auto_insert_bullets = 0
475 In that case, you probably also want to set the new list item indent to 0
476 as well, or you will have to remove an indent each time you add a new list
479 let g:vim_markdown_new_list_item_indent = 0
481 -------------------------------------------------------------------------------
482 *vim-markdown-change-how-to-open-new-files*
483 Change how to open new files ~
485 *g:vim_markdown_edit_url_in*
486 - 'g:vim_markdown_edit_url_in'
488 By default when following a link the target file will be opened in your
489 current buffer. This behavior can change if you prefer using splits or tabs
490 by using the 'vim_markdown_edit_url_in' variable. Possible values are
491 'tab', 'vsplit', 'hsplit', 'current' opening in a new tab, vertical split,
492 horizontal split, and current buffer respectively. Defaults to current
495 let g:vim_markdown_edit_url_in = 'tab'
497 -------------------------------------------------------------------------------
498 *vim-markdown-support-borderless-tables*
499 Support borderless tables ~
501 *g:vim_markdown_borderless_table*
502 - 'g:vim_markdown_borderless_table'
504 Add support for borderless tables, such as:
512 let g:vim_markdown_borderless_table = 1
514 the table would be formatted as usual:
516 | header 1 | header 2 |
517 |----------|----------|
521 ===============================================================================
522 *vim-markdown-mappings*
525 The following work on normal and visual modes:
528 - 'gx': open the link under the cursor in the same browser as the standard
529 'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
531 The standard 'gx' is extended by allowing you to put your cursor anywhere
534 For example, all the following cursor positions will work:
536 [Example](http://example.com)
544 Known limitation: does not work for links that span multiple lines.
547 - 'ge': open the link under the cursor in Vim for editing. Useful for
548 relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
550 The rules for the cursor position are the same as the 'gx' command.
553 - ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
556 - '[[': go to previous header. Contrast with ']h'.
557 '<Plug>Markdown_MoveToPreviousHeader'
560 - '][': go to next sibling header if any.
561 '<Plug>Markdown_MoveToNextSiblingHeader'
564 - '[]': go to previous sibling header if any.
565 '<Plug>Markdown_MoveToPreviousSiblingHeader'
568 - ']h': go to Current header. '<Plug>Markdown_MoveToCurHeader'
571 - ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
573 This plugin follows the recommended Vim plugin mapping interface, so to change
574 the map ']u' to 'asdf', add to your '.vimrc':
576 map asdf <Plug>Markdown_MoveToParentHeader
578 To disable a map use:
580 map <Plug> <Plug>Markdown_MoveToParentHeader
582 ===============================================================================
583 *vim-markdown-commands*
586 The following requires ':filetype plugin on'.
591 Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
593 If range is given, only operate in the range.
595 If an 'h1' would be decreased, abort.
597 For simplicity of implementation, Setex headers are converted to Atx.
600 - ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
606 Convert all Setex style headers in buffer to Atx.
608 If a range is given, e.g. hit ':' from visual mode, only operate on the
612 - ':TableFormat': Format the table under the cursor like this [10].
614 Requires Tabular [11].
616 The input table _must_ already have a separator line as the second line of
617 the table. That line only needs to contain the correct pipes '|', nothing
621 - ':Toc': create a quickfix vertical window navigable table of contents with
624 Hit '<Enter>' on a line to jump to the corresponding line of the markdown
628 - ':Toch': Same as ':Toc' but in an horizontal window.
631 - ':Toct': Same as ':Toc' but in a new tab.
634 - ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
636 ===============================================================================
637 *vim-markdown-credits*
640 The main contributors of vim-markdown are:
642 - **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
643 markdown. Homepage [12].
645 If you feel that your name should be on this list, please make a pull request
646 listing your contributions.
648 ===============================================================================
649 *vim-markdown-license*
652 The MIT License (MIT)
654 Copyright (c) 2012 Benjamin D. Williams
656 Permission is hereby granted, free of charge, to any person obtaining a copy of
657 this software and associated documentation files (the "Software"), to deal in
658 the Software without restriction, including without limitation the rights to
659 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
660 of the Software, and to permit persons to whom the Software is furnished to do
661 so, subject to the following conditions:
663 The above copyright notice and this permission notice shall be included in all
664 copies or substantial portions of the Software.
666 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
667 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
668 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
669 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
670 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
671 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
674 ===============================================================================
675 *vim-markdown-references*
678 [1] http://daringfireball.net/projects/markdown/
679 [2] https://github.com/gmarik/vundle
680 [3] https://github.com/tpope/vim-pathogen
681 [4] http://packages.qa.debian.org/v/vim-addon-manager.html
682 [5] https://github.com/preservim/vim-markdown/archive/master.tar.gz
683 [6] https://github.com/klen/python-mode
684 [7] https://gohugo.io/content/front-matter/
685 [8] https://github.com/cespare/vim-toml
686 [9] https://github.com/elzr/vim-json
687 [10] http://www.cirosantilli.com/markdown-style-guide/#tables
688 [11] https://github.com/godlygeek/tabular
689 [12] http://plasticboy.com/