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 'plasticboy/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/plasticboy/vim-markdown.git
72 To install without Pathogen using the Debian vim-addon-manager [4], do this:
74 git clone https://github.com/plasticboy/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': open a fold your cursor is on
107 - 'zA': open a fold your cursor is on recursively
109 - 'zc': close a fold your cursor is on
111 - 'zC': close a fold your cursor is on recursively
113 Options are available to disable folding or change folding style.
115 Try ':help fold-expr' and ':help fold-commands' for details.
117 -------------------------------------------------------------------------------
118 *vim-markdown-concealing*
121 Concealing is set for some syntax such as bold, italic, code block and link.
123 Concealing lets you conceal text with other text. The actual source text is not
124 modified. If you put your cursor on the concealed line, the conceal goes away.
126 Options are available to disable or change concealing.
128 Try ':help concealcursor' and ':help conceallevel' for details.
130 ===============================================================================
131 *vim-markdown-options*
134 -------------------------------------------------------------------------------
135 *vim-markdown-disable-folding*
138 *g:vim_markdown_folding_disabled*
139 - 'g:vim_markdown_folding_disabled'
141 Add the following line to your '.vimrc' to disable the folding
144 let g:vim_markdown_folding_disabled = 1
146 This option only controls Vim Markdown specific folding configuration.
148 To enable/disable folding use Vim's standard folding configuration.
152 -------------------------------------------------------------------------------
153 *vim-markdown-change-fold-style*
156 *g:vim_markdown_folding_style_pythonic*
157 - 'g:vim_markdown_folding_style_pythonic'
159 To fold in a style like python-mode [6], add the following to your
162 let g:vim_markdown_folding_style_pythonic = 1
164 Level 1 heading which is served as a document title is not folded.
165 'g:vim_markdown_folding_level' setting is not active with this fold style.
167 *g:vim_markdown_override_foldtext*
168 - 'g:vim_markdown_override_foldtext'
170 To prevent foldtext from being set add the following to your '.vimrc':
172 let g:vim_markdown_override_foldtext = 0
174 -------------------------------------------------------------------------------
175 *vim-markdown-set-header-folding-level*
176 Set header folding level ~
178 *g:vim_markdown_folding_level*
179 - 'g:vim_markdown_folding_level'
181 Folding level is a number between 1 and 6. By default, if not specified, it
184 let g:vim_markdown_folding_level = 6
186 Tip: it can be changed on the fly with:
188 :let g:vim_markdown_folding_level = 1
191 -------------------------------------------------------------------------------
192 *vim-markdown-disable-default-key-mappings*
193 Disable Default Key Mappings ~
195 *g:vim_markdown_no_default_key_mappings*
196 - 'g:vim_markdown_no_default_key_mappings'
198 Add the following line to your '.vimrc' to disable default key mappings:
200 let g:vim_markdown_no_default_key_mappings = 1
202 You can also map them by yourself with '<Plug>' mappings.
204 -------------------------------------------------------------------------------
205 *vim-markdown-enable-toc-window-auto-fit*
206 Enable TOC window auto-fit ~
208 *g:vim_markdown_toc_autofit*
209 - 'g:vim_markdown_toc_autofit'
211 Allow for the TOC window to auto-fit when it's possible for it to shrink.
212 It never increases its default size (half screen), it only shrinks.
214 let g:vim_markdown_toc_autofit = 1
216 -------------------------------------------------------------------------------
217 *vim-markdown-text-emphasis-restriction-to-single-lines*
218 Text emphasis restriction to single-lines ~
220 *g:vim_markdown_emphasis_multiline*
221 - 'g:vim_markdown_emphasis_multiline'
223 By default text emphasis works across multiple lines until a closing token
224 is found. However, it's possible to restrict text emphasis to a single line
225 (i.e., for it to be applied a closing token must be found on the same
228 let g:vim_markdown_emphasis_multiline = 0
230 -------------------------------------------------------------------------------
231 *vim-markdown-syntax-concealing*
234 *g:vim_markdown_conceal*
235 - 'g:vim_markdown_conceal'
237 Concealing is set for some syntax.
239 For example, conceal '[link text](link url)' as just 'link text'. Also,
240 '_italic_' and '*italic*' will conceal to just _italic_. Similarly
241 '__bold__', '**bold**', '___italic bold___', and '***italic bold***' will
242 conceal to just **bold**, **bold**, **_italic bold_**, and **_italic
243 bold_** respectively.
245 To enable conceal use Vim's standard conceal configuration.
249 To disable conceal regardless of 'conceallevel' setting, add the following
252 let g:vim_markdown_conceal = 0
254 To disable math conceal with LaTeX math syntax enabled, add the following
257 let g:tex_conceal = ""
258 let g:vim_markdown_math = 1
260 *g:vim_markdown_conceal_code_blocks*
261 - 'g:vim_markdown_conceal_code_blocks'
263 Disabling conceal for code fences requires an additional setting:
265 let g:vim_markdown_conceal_code_blocks = 0
267 -------------------------------------------------------------------------------
268 *vim-markdown-fenced-code-block-languages*
269 Fenced code block languages ~
271 *g:vim_markdown_fenced_languages*
272 - 'g:vim_markdown_fenced_languages'
274 You can use filetype name as fenced code block languages for syntax
275 highlighting. If you want to use different name from filetype, you can add
276 it in your '.vimrc' like so:
278 let g:vim_markdown_fenced_languages = ['csharp=cs']
280 This will cause the following to be highlighted using the 'cs' filetype
287 Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
289 -------------------------------------------------------------------------------
290 *vim-markdown-follow-named-anchors*
291 Follow named anchors ~
293 *g:vim_markdown_follow_anchor*
294 - 'g:vim_markdown_follow_anchor'
296 This feature allows the 'ge' command to follow named anchors in links of
297 the form 'file#anchor' or just '#anchor', where file may omit the '.md'
298 extension as usual. Two variables control its operation:
300 let g:vim_markdown_follow_anchor = 1
302 This tells vim-markdown whether to attempt to follow a named anchor in a
303 link or not. When it is 1, and only if a link can be split in two parts by
304 the pattern '#', then the first part is interpreted as the file and the
305 second one as the named anchor. This also includes urls of the form
306 '#anchor', for which the first part is considered empty, meaning that the
307 target file is the current one. After the file is opened, the anchor will
312 *g:vim_markdown_anchorexpr*
313 - 'g:vim_markdown_anchorexpr'
315 let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
317 This expression will be evaluated substituting 'v:anchor' with a quoted
318 string that contains the anchor to visit. The result of the evaluation will
319 become the real anchor to search in the target file. This is useful in
320 order to convert anchors of the form, say, 'my-section-title' to searches
321 of the form 'My Section Title' or '<<my-section-title>>'.
325 -------------------------------------------------------------------------------
326 *vim-markdown-syntax-extensions*
329 The following options control which syntax extensions will be turned on. They
332 -------------------------------------------------------------------------------
333 *vim-markdown-latex-math*
336 *g:vim_markdown_math*
337 - 'g:vim_markdown_math'
339 Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
341 let g:vim_markdown_math = 1
343 -------------------------------------------------------------------------------
344 *vim-markdown-yaml-front-matter*
347 *g:vim_markdown_frontmatter*
348 - 'g:vim_markdown_frontmatter'
350 Highlight YAML front matter as used by Jekyll or Hugo [7].
352 let g:vim_markdown_frontmatter = 1
354 -------------------------------------------------------------------------------
355 *vim-markdown-toml-front-matter*
358 *g:vim_markdown_toml_frontmatter*
359 - 'g:vim_markdown_toml_frontmatter'
361 Highlight TOML front matter as used by Hugo [7].
363 TOML syntax highlight requires vim-toml [8].
365 let g:vim_markdown_toml_frontmatter = 1
367 -------------------------------------------------------------------------------
368 *vim-markdown-json-front-matter*
371 *g:vim_markdown_json_frontmatter*
372 - 'g:vim_markdown_json_frontmatter'
374 Highlight JSON front matter as used by Hugo [7].
376 JSON syntax highlight requires vim-json [9].
378 let g:vim_markdown_json_frontmatter = 1
380 -------------------------------------------------------------------------------
381 *vim-markdown-strikethrough*
384 *g:vim_markdown_strikethrough*
385 - 'g:vim_markdown_strikethrough'
387 Strikethrough uses two tildes. '~~Scratch this.~~'
389 let g:vim_markdown_strikethrough = 1
391 -------------------------------------------------------------------------------
392 *vim-markdown-adjust-new-list-item-indent*
393 Adjust new list item indent ~
395 *g:vim_markdown_new_list_item_indent*
396 - 'g:vim_markdown_new_list_item_indent'
398 You can adjust a new list indent. For example, you insert a single line
403 Then if you type 'o' to insert new line in vim and type '* item2', the
409 vim-markdown automatically insert the indent. By default, the number of
410 spaces of indent is 4. If you'd like to change the number as 2, just write:
412 let g:vim_markdown_new_list_item_indent = 2
414 -------------------------------------------------------------------------------
415 *vim-markdown-do-not-require-.md-extensions-for-markdown-links*
416 Do not require .md extensions for Markdown links ~
418 *g:vim_markdown_no_extensions_in_markdown*
419 - 'g:vim_markdown_no_extensions_in_markdown'
421 If you want to have a link like this '[link text](link-url)' and follow it
422 for editing in vim using the 'ge' command, but have it open the file "link-
423 url.md" instead of the file "link-url", then use this option:
425 let g:vim_markdown_no_extensions_in_markdown = 1
427 This is super useful for GitLab and GitHub wiki repositories.
429 Normal behaviour would be that vim-markup required you to do this '[link
430 text](link-url.md)', but this is not how the Gitlab and GitHub wiki
431 repositories work. So this option adds some consistency between the two.
433 -------------------------------------------------------------------------------
434 *vim-markdown-auto-write-when-following-link*
435 Auto-write when following link ~
437 *g:vim_markdown_autowrite*
438 - 'g:vim_markdown_autowrite'
440 If you follow a link like this '[link text](link-url)' using the 'ge'
441 shortcut, this option will automatically save any edits you made before
444 let g:vim_markdown_autowrite = 1
446 -------------------------------------------------------------------------------
447 *vim-markdown-change-default-file-extension*
448 Change default file extension ~
450 *g:vim_markdown_auto_extension_ext*
451 - 'g:vim_markdown_auto_extension_ext'
453 If you would like to use a file extension other than '.md' you may do so
454 using the 'vim_markdown_auto_extension_ext' variable:
456 let g:vim_markdown_auto_extension_ext = 'txt'
458 -------------------------------------------------------------------------------
459 *vim-markdown-do-not-automatically-insert-bulletpoints*
460 Do not automatically insert bulletpoints ~
462 *g:vim_markdown_auto_insert_bullets*
463 - 'g:vim_markdown_auto_insert_bullets'
465 Automatically inserting bulletpoints can lead to problems when wrapping
466 text (see issue #232 for details), so it can be disabled:
468 let g:vim_markdown_auto_insert_bullets = 0
470 In that case, you probably also want to set the new list item indent to 0
471 as well, or you will have to remove an indent each time you add a new list
474 let g:vim_markdown_new_list_item_indent = 0
476 -------------------------------------------------------------------------------
477 *vim-markdown-change-how-to-open-new-files*
478 Change how to open new files ~
480 *g:vim_markdown_edit_url_in*
481 - 'g:vim_markdown_edit_url_in'
483 By default when following a link the target file will be opened in your
484 current buffer. This behavior can change if you prefer using splits or tabs
485 by using the 'vim_markdown_edit_url_in' variable. Possible values are
486 'tab', 'vsplit', 'hsplit', 'current' opening in a new tab, vertical split,
487 horizontal split, and current buffer respectively. Defaults to current
490 let g:vim_markdown_edit_url_in = 'tab'
492 ===============================================================================
493 *vim-markdown-mappings*
496 The following work on normal and visual modes:
499 - 'gx': open the link under the cursor in the same browser as the standard
500 'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
502 The standard 'gx' is extended by allowing you to put your cursor anywhere
505 For example, all the following cursor positions will work:
507 [Example](http://example.com)
515 Known limitation: does not work for links that span multiple lines.
518 - 'ge': open the link under the cursor in Vim for editing. Useful for
519 relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
521 The rules for the cursor position are the same as the 'gx' command.
524 - ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
527 - '[[': go to previous header. Contrast with ']c'.
528 '<Plug>Markdown_MoveToPreviousHeader'
531 - '][': go to next sibling header if any.
532 '<Plug>Markdown_MoveToNextSiblingHeader'
535 - '[]': go to previous sibling header if any.
536 '<Plug>Markdown_MoveToPreviousSiblingHeader'
539 - ']c': go to Current header. '<Plug>Markdown_MoveToCurHeader'
542 - ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
544 This plugin follows the recommended Vim plugin mapping interface, so to change
545 the map ']u' to 'asdf', add to your '.vimrc':
547 map asdf <Plug>Markdown_MoveToParentHeader
549 To disable a map use:
551 map <Plug> <Plug>Markdown_MoveToParentHeader
553 ===============================================================================
554 *vim-markdown-commands*
557 The following requires ':filetype plugin on'.
562 Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
564 If range is given, only operate in the range.
566 If an 'h1' would be decreased, abort.
568 For simplicity of implementation, Setex headers are converted to Atx.
571 - ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
577 Convert all Setex style headers in buffer to Atx.
579 If a range is given, e.g. hit ':' from visual mode, only operate on the
583 - ':TableFormat': Format the table under the cursor like this [10].
585 Requires Tabular [11].
587 The input table _must_ already have a separator line as the second line of
588 the table. That line only needs to contain the correct pipes '|', nothing
592 - ':Toc': create a quickfix vertical window navigable table of contents with
595 Hit '<Enter>' on a line to jump to the corresponding line of the markdown
599 - ':Toch': Same as ':Toc' but in an horizontal window.
602 - ':Toct': Same as ':Toc' but in a new tab.
605 - ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
607 ===============================================================================
608 *vim-markdown-credits*
611 The main contributors of vim-markdown are:
613 - **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
614 markdown. Homepage [12].
616 If you feel that your name should be on this list, please make a pull request
617 listing your contributions.
619 ===============================================================================
620 *vim-markdown-license*
623 The MIT License (MIT)
625 Copyright (c) 2012 Benjamin D. Williams
627 Permission is hereby granted, free of charge, to any person obtaining a copy of
628 this software and associated documentation files (the "Software"), to deal in
629 the Software without restriction, including without limitation the rights to
630 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
631 of the Software, and to permit persons to whom the Software is furnished to do
632 so, subject to the following conditions:
634 The above copyright notice and this permission notice shall be included in all
635 copies or substantial portions of the Software.
637 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
638 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
639 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
640 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
641 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
642 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
645 ===============================================================================
646 *vim-markdown-references*
649 [1] http://daringfireball.net/projects/markdown/
650 [2] https://github.com/gmarik/vundle
651 [3] https://github.com/tpope/vim-pathogen
652 [4] http://packages.qa.debian.org/v/vim-addon-manager.html
653 [5] https://github.com/plasticboy/vim-markdown/archive/master.tar.gz
654 [6] https://github.com/klen/python-mode
655 [7] https://gohugo.io/content/front-matter/
656 [8] https://github.com/cespare/vim-toml
657 [9] https://github.com/elzr/vim-json
658 [10] http://www.cirosantilli.com/markdown-style-guide/#tables
659 [11] https://github.com/godlygeek/tabular
660 [12] http://plasticboy.com/