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. Options |vim-markdown-options|
9 1. Disable Folding |vim-markdown-disable-folding|
10 2. Change fold style |vim-markdown-change-fold-style|
11 3. Set header folding level |vim-markdown-set-header-folding-level|
12 4. Disable Default Key Mappings |vim-markdown-disable-default-key-mappings|
13 5. Enable TOC window auto-fit |vim-markdown-enable-toc-window-auto-fit|
14 6. Text emphasis restriction to single-lines
15 |vim-markdown-text-emphasis-restriction-to-single-lines|
16 7. Syntax Concealing |vim-markdown-syntax-concealing|
17 8. Fenced code block languages |vim-markdown-fenced-code-block-languages|
18 9. Follow named anchors |vim-markdown-follow-named-anchors|
19 10. Syntax extensions |vim-markdown-syntax-extensions|
20 1. LaTeX math |vim-markdown-latex-math|
21 2. YAML Front Matter |vim-markdown-yaml-front-matter|
22 3. TOML Front Matter |vim-markdown-toml-front-matter|
23 4. JSON Front Matter |vim-markdown-json-front-matter|
24 11. Adjust new list item indent |vim-markdown-adjust-new-list-item-indent|
25 12. Do not require .md extensions for Markdown links
26 |vim-markdown-do-not-require-.md-extensions-for-markdown-links|
27 13. Auto-write when following link
28 |vim-markdown-auto-write-when-following-link|
29 14. Change default file extension
30 |vim-markdown-change-default-file-extension|
31 15. Do not automatically insert bulletpoints
32 |vim-markdown-do-not-automatically-insert-bulletpoints|
33 16. Change how to open new files |vim-markdown-change-how-to-open-new-files|
34 4. Mappings |vim-markdown-mappings|
35 5. Commands |vim-markdown-commands|
36 6. Credits |vim-markdown-credits|
37 7. License |vim-markdown-license|
38 8. References |vim-markdown-references|
40 ===============================================================================
41 *vim-markdown-introduction*
44 Syntax highlighting, matching rules and mappings for the original Markdown [1]
47 ===============================================================================
48 *vim-markdown-installation*
51 If you use Vundle [2], add the following line to your '~/.vimrc':
53 Plugin 'godlygeek/tabular'
54 Plugin 'plasticboy/vim-markdown'
56 The 'tabular' plugin must come _before_ 'vim-markdown'.
63 If you use Pathogen [3], do this:
66 git clone https://github.com/plasticboy/vim-markdown.git
68 To install without Pathogen using the Debian vim-addon-manager [4], do this:
70 git clone https://github.com/plasticboy/vim-markdown.git
73 vim-addon-manager install markdown
75 If you are not using any package manager, download the tarball [5] and do this:
78 tar --strip=1 -zxf vim-markdown-master.tar.gz
80 ===============================================================================
81 *vim-markdown-options*
84 -------------------------------------------------------------------------------
85 *vim-markdown-disable-folding*
88 Add the following line to your '.vimrc' to disable the folding configuration:
90 let g:vim_markdown_folding_disabled = 1
92 This option only controls Vim Markdown specific folding configuration.
94 To enable/disable folding use Vim's standard folding configuration.
98 -------------------------------------------------------------------------------
99 *vim-markdown-change-fold-style*
102 To fold in a style like python-mode [6], add the following to your '.vimrc':
104 let g:vim_markdown_folding_style_pythonic = 1
106 Level 1 heading which is served as a document title is not folded.
107 'g:vim_markdown_folding_level' setting is not active with this fold style.
109 To prevent foldtext from being set add the following to your '.vimrc':
111 let g:vim_markdown_override_foldtext = 0
113 -------------------------------------------------------------------------------
114 *vim-markdown-set-header-folding-level*
115 Set header folding level ~
117 Folding level is a number between 1 and 6. By default, if not specified, it is
120 let g:vim_markdown_folding_level = 6
122 Tip: it can be changed on the fly with:
124 :let g:vim_markdown_folding_level = 1
127 -------------------------------------------------------------------------------
128 *vim-markdown-disable-default-key-mappings*
129 Disable Default Key Mappings ~
131 Add the following line to your '.vimrc' to disable default key mappings:
133 let g:vim_markdown_no_default_key_mappings = 1
135 You can also map them by yourself with '<Plug>' mappings.
137 -------------------------------------------------------------------------------
138 *vim-markdown-enable-toc-window-auto-fit*
139 Enable TOC window auto-fit ~
141 Allow for the TOC window to auto-fit when it's possible for it to shrink. It
142 never increases its default size (half screen), it only shrinks.
144 let g:vim_markdown_toc_autofit = 1
146 -------------------------------------------------------------------------------
147 *vim-markdown-text-emphasis-restriction-to-single-lines*
148 Text emphasis restriction to single-lines ~
150 By default text emphasis works across multiple lines until a closing token is
151 found. However, it's possible to restrict text emphasis to a single line (i.e.,
152 for it to be applied a closing token must be found on the same line). To do so:
154 let g:vim_markdown_emphasis_multiline = 0
156 -------------------------------------------------------------------------------
157 *vim-markdown-syntax-concealing*
160 Concealing is set for some syntax.
162 For example, conceal '[link text](link url)' as just 'link text'. Also,
163 '_italic_' and '*italic*' will conceal to just _italic_. Similarly '__bold__',
164 '**bold**', '___italic bold___', and '***italic bold***' will conceal to just
165 **bold**, **bold**, **_italic bold_**, and **_italic bold_** respectively.
167 To enable conceal use Vim's standard conceal configuration.
171 To disable conceal regardless of 'conceallevel' setting, add the following to
174 let g:vim_markdown_conceal = 0
176 To disable math conceal with LaTeX math syntax enabled, add the following to
179 let g:tex_conceal = ""
180 let g:vim_markdown_math = 1
182 -------------------------------------------------------------------------------
183 *vim-markdown-fenced-code-block-languages*
184 Fenced code block languages ~
186 You can use filetype name as fenced code block languages for syntax
187 highlighting. If you want to use different name from filetype, you can add it
188 in your '.vimrc' like so:
190 let g:vim_markdown_fenced_languages = ['csharp=cs']
192 This will cause the following to be highlighted using the 'cs' filetype syntax.
198 Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
200 -------------------------------------------------------------------------------
201 *vim-markdown-follow-named-anchors*
202 Follow named anchors ~
204 This feature allows the 'ge' command to follow named anchors in links of the
205 form 'file#anchor' or just '#anchor', where file may omit the '.md' extension
206 as usual. Two variables control its operation:
208 let g:vim_markdown_follow_anchor = 1
210 This tells vim-markdown whether to attempt to follow a named anchor in a link
211 or not. When it is 1, and only if a link can be split in two parts by the
212 pattern '#', then the first part is interpreted as the file and the second one
213 as the named anchor. This also includes urls of the form '#anchor', for which
214 the first part is considered empty, meaning that the target file is the current
215 one. After the file is opened, the anchor will be searched.
219 let g:vim_markdown_anchorexpr = "'<<'.v:anchor.'>>'"
221 This expression will be evaluated substituting 'v:anchor' with a quoted string
222 that contains the anchor to visit. The result of the evaluation will become the
223 real anchor to search in the target file. This is useful in order to convert
224 anchors of the form, say, 'my-section-title' to searches of the form 'My
225 Section Title' or '<<my-section-title>>'.
229 -------------------------------------------------------------------------------
230 *vim-markdown-syntax-extensions*
233 The following options control which syntax extensions will be turned on. They
236 -------------------------------------------------------------------------------
237 *vim-markdown-latex-math*
240 Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
242 let g:vim_markdown_math = 1
244 -------------------------------------------------------------------------------
245 *vim-markdown-yaml-front-matter*
248 Highlight YAML front matter as used by Jekyll or Hugo [7].
250 let g:vim_markdown_frontmatter = 1
252 -------------------------------------------------------------------------------
253 *vim-markdown-toml-front-matter*
256 Highlight TOML front matter as used by Hugo [7].
258 TOML syntax highlight requires vim-toml [8].
260 let g:vim_markdown_toml_frontmatter = 1
262 -------------------------------------------------------------------------------
263 *vim-markdown-json-front-matter*
266 Highlight JSON front matter as used by Hugo [7].
268 JSON syntax highlight requires vim-json [9].
270 let g:vim_markdown_json_frontmatter = 1
272 -------------------------------------------------------------------------------
273 *vim-markdown-adjust-new-list-item-indent*
274 Adjust new list item indent ~
276 You can adjust a new list indent. For example, you insert a single line like
281 Then if you type 'o' to insert new line in vim and type '* item2', the result
287 vim-markdown automatically insert the indent. By default, the number of spaces
288 of indent is 4. If you'd like to change the number as 2, just write:
290 let g:vim_markdown_new_list_item_indent = 2
292 -------------------------------------------------------------------------------
293 *vim-markdown-do-not-require-.md-extensions-for-markdown-links*
294 Do not require .md extensions for Markdown links ~
296 If you want to have a link like this '[link text](link-url)' and follow it for
297 editing in vim using the 'ge' command, but have it open the file "link-url.md"
298 instead of the file "link-url", then use this option:
300 let g:vim_markdown_no_extensions_in_markdown = 1
302 This is super useful for GitLab and GitHub wiki repositories.
304 Normal behaviour would be that vim-markup required you to do this '[link text
305 ](link-url.md)', but this is not how the Gitlab and GitHub wiki repositories
306 work. So this option adds some consistency between the two.
308 -------------------------------------------------------------------------------
309 *vim-markdown-auto-write-when-following-link*
310 Auto-write when following link ~
312 If you follow a link like this '[link text](link-url)' using the 'ge' shortcut,
313 this option will automatically save any edits you made before moving you:
315 let g:vim_markdown_autowrite = 1
317 -------------------------------------------------------------------------------
318 *vim-markdown-change-default-file-extension*
319 Change default file extension ~
321 If you would like to use a file extension other than '.md' you may do so using
322 the 'vim_markdown_auto_extension_ext' variable:
324 let g:vim_markdown_auto_extension_ext = 'txt'
326 -------------------------------------------------------------------------------
327 *vim-markdown-do-not-automatically-insert-bulletpoints*
328 Do not automatically insert bulletpoints ~
330 Automatically inserting bulletpoints can lead to problems when wrapping text
331 (see issue #232 for details), so it can be disabled:
333 let g:vim_markdown_auto_insert_bullets = 0
335 In that case, you probably also want to set the new list item indent to 0 as
336 well, or you will have to remove an indent each time you add a new list item:
338 let g:vim_markdown_new_list_item_indent = 0
340 -------------------------------------------------------------------------------
341 *vim-markdown-change-how-to-open-new-files*
342 Change how to open new files ~
344 By default when following a link the target file will be opened in your current
345 buffer. This behavior can change if you prefer using splits or tabs by using
346 the 'vim_markdown_edit_url_in' variable. Possible values are 'tab', 'vsplit',
347 'hsplit', 'current' opening in a new tab, vertical split, horizontal split, and
348 current buffer respectively. Defaults to current buffer if not set:
350 let g:vim_markdown_edit_url_in = 'tab'
352 ===============================================================================
353 *vim-markdown-mappings*
356 The following work on normal and visual modes:
359 - 'gx': open the link under the cursor in the same browser as the standard
360 'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
362 The standard 'gx' is extended by allowing you to put your cursor anywhere
365 For example, all the following cursor positions will work:
367 [Example](http://example.com)
375 Known limitation: does not work for links that span multiple lines.
378 - 'ge': open the link under the cursor in Vim for editing. Useful for
379 relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
381 The rules for the cursor position are the same as the 'gx' command.
384 - ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
387 - '[[': go to previous header. Contrast with ']c'.
388 '<Plug>Markdown_MoveToPreviousHeader'
391 - '][': go to next sibling header if any.
392 '<Plug>Markdown_MoveToNextSiblingHeader'
395 - '[]': go to previous sibling header if any.
396 '<Plug>Markdown_MoveToPreviousSiblingHeader'
399 - ']c': go to Current header. '<Plug>Markdown_MoveToCurHeader'
402 - ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
404 This plugin follows the recommended Vim plugin mapping interface, so to change
405 the map ']u' to 'asdf', add to your '.vimrc':
407 map asdf <Plug>Markdown_MoveToParentHeader
409 To disable a map use:
411 map <Plug> <Plug>Markdown_MoveToParentHeader
413 ===============================================================================
414 *vim-markdown-commands*
417 The following requires ':filetype plugin on'.
422 Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
424 If range is given, only operate in the range.
426 If an 'h1' would be decreased, abort.
428 For simplicity of implementation, Setex headers are converted to Atx.
431 - ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
437 Convert all Setex style headers in buffer to Atx.
439 If a range is given, e.g. hit ':' from visual mode, only operate on the
443 - ':TableFormat': Format the table under the cursor like this [10].
445 Requires Tabular [11].
447 The input table _must_ already have a separator line as the second line of
448 the table. That line only needs to contain the correct pipes '|', nothing
452 - ':Toc': create a quickfix vertical window navigable table of contents with
455 Hit '<Enter>' on a line to jump to the corresponding line of the markdown
459 - ':Toch': Same as ':Toc' but in an horizontal window.
462 - ':Toct': Same as ':Toc' but in a new tab.
465 - ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
467 ===============================================================================
468 *vim-markdown-credits*
471 The main contributors of vim-markdown are:
473 - **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
474 markdown. Homepage [12].
476 If you feel that your name should be on this list, please make a pull request
477 listing your contributions.
479 ===============================================================================
480 *vim-markdown-license*
483 The MIT License (MIT)
485 Copyright (c) 2012 Benjamin D. Williams
487 Permission is hereby granted, free of charge, to any person obtaining a copy of
488 this software and associated documentation files (the "Software"), to deal in
489 the Software without restriction, including without limitation the rights to
490 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
491 of the Software, and to permit persons to whom the Software is furnished to do
492 so, subject to the following conditions:
494 The above copyright notice and this permission notice shall be included in all
495 copies or substantial portions of the Software.
497 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
498 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
499 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
500 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
501 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
502 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
505 ===============================================================================
506 *vim-markdown-references*
509 [1] http://daringfireball.net/projects/markdown/
510 [2] https://github.com/gmarik/vundle
511 [3] https://github.com/tpope/vim-pathogen
512 [4] http://packages.qa.debian.org/v/vim-addon-manager.html
513 [5] https://github.com/plasticboy/vim-markdown/archive/master.tar.gz
514 [6] https://github.com/klen/python-mode
515 [7] https://gohugo.io/content/front-matter/
516 [8] https://github.com/cespare/vim-toml
517 [9] https://github.com/elzr/vim-json
518 [10] http://www.cirosantilli.com/markdown-style-guide/#tables
519 [11] https://github.com/godlygeek/tabular
520 [12] http://plasticboy.com/