]> git.madduck.net Git - etc/vim.git/blob - doc/vim-markdown.txt

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

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.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge pull request #297 from KainokiKaede/master
[etc/vim.git] / doc / vim-markdown.txt
1 *vim-markdown*  Vim Markdown
2
3 ===============================================================================
4 Contents ~
5
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. Syntax extensions                         |vim-markdown-syntax-extensions|
19    1. LaTeX math                                      |vim-markdown-latex-math|
20    2. YAML Front Matter                        |vim-markdown-yaml-front-matter|
21    3. TOML Front Matter                        |vim-markdown-toml-front-matter|
22    4. JSON Front Matter                        |vim-markdown-json-front-matter|
23   10. Adjust new list item indent    |vim-markdown-adjust-new-list-item-indent|
24  4. Mappings                                            |vim-markdown-mappings|
25  5. Commands                                            |vim-markdown-commands|
26  6. Credits                                              |vim-markdown-credits|
27  7. License                                              |vim-markdown-license|
28  8. References                                        |vim-markdown-references|
29
30 ===============================================================================
31                                                     *vim-markdown-introduction*
32 Introduction ~
33
34 Syntax highlighting, matching rules and mappings for the original Markdown [1]
35 and extensions.
36
37 ===============================================================================
38                                                     *vim-markdown-installation*
39 Installation ~
40
41 If you use Vundle [2], add the following line to your '~/.vimrc':
42 >
43   Plugin 'godlygeek/tabular'
44   Plugin 'plasticboy/vim-markdown'
45 <
46 The 'tabular' plugin must come _before_ 'vim-markdown'.
47
48 Then run inside Vim:
49 >
50   :so ~/.vimrc
51   :PluginInstall
52 <
53 If you use Pathogen [3], do this:
54 >
55   cd ~/.vim/bundle
56   git clone https://github.com/plasticboy/vim-markdown.git
57 <
58 To install without Pathogen using the Debian vim-addon-manager [4], do this:
59 >
60   git clone https://github.com/plasticboy/vim-markdown.git
61   cd vim-markdown
62   sudo make install
63   vim-addon-manager install markdown
64 <
65 If you are not using any package manager, download the tarball [5] and do this:
66 >
67   cd ~/.vim
68   tar --strip=1 -zxf vim-markdown-master.tar.gz
69 <
70 ===============================================================================
71                                                          *vim-markdown-options*
72 Options ~
73
74 -------------------------------------------------------------------------------
75                                                  *vim-markdown-disable-folding*
76 Disable Folding ~
77
78 Add the following line to your '.vimrc' to disable the folding configuration:
79 >
80   let g:vim_markdown_folding_disabled = 1
81 <
82 This option only controls Vim Markdown specific folding configuration.
83
84 To enable/disable folding use Vim's standard folding configuration.
85 >
86   set [no]foldenable
87 <
88 -------------------------------------------------------------------------------
89                                                *vim-markdown-change-fold-style*
90 Change fold style ~
91
92 To fold in a style like python-mode [6], add the following to your '.vimrc':
93 >
94   let g:vim_markdown_folding_style_pythonic = 1
95 <
96 Level 1 heading which is served as a document title is not folded.
97 'g:vim_markdown_folding_level' setting is not active with this fold style.
98
99 To prevent foldtext from being overridden, add the following to your '.vimrc':
100
101   let g:vim_markdown_override_foldtext = 0
102
103 -------------------------------------------------------------------------------
104                                         *vim-markdown-set-header-folding-level*
105 Set header folding level ~
106
107 Folding level is a number between 1 and 6. By default, if not specified, it is
108 set to 1.
109 >
110   let g:vim_markdown_folding_level = 6
111 <
112 Tip: it can be changed on the fly with:
113 >
114   :let g:vim_markdown_folding_level = 1
115   :edit
116 <
117 -------------------------------------------------------------------------------
118                                     *vim-markdown-disable-default-key-mappings*
119 Disable Default Key Mappings ~
120
121 Add the following line to your '.vimrc' to disable default key mappings:
122 >
123   let g:vim_markdown_no_default_key_mappings = 1
124 <
125 You can also map them by yourself with '<Plug>' mappings.
126
127 -------------------------------------------------------------------------------
128                                       *vim-markdown-enable-toc-window-auto-fit*
129 Enable TOC window auto-fit ~
130
131 Allow for the TOC window to auto-fit when it's possible for it to shrink. It
132 never increases its default size (half screen), it only shrinks.
133 >
134   let g:vim_markdown_toc_autofit = 1
135 <
136 -------------------------------------------------------------------------------
137                        *vim-markdown-text-emphasis-restriction-to-single-lines*
138 Text emphasis restriction to single-lines ~
139
140 By default text emphasis works across multiple lines until a closing token is
141 found. However, it's possible to restrict text emphasis to a single line (ie,
142 for it to be applied a closing token must be found on the same line). To do so:
143 >
144   let g:vim_markdown_emphasis_multiline = 0
145 <
146 -------------------------------------------------------------------------------
147                                                *vim-markdown-syntax-concealing*
148 Syntax Concealing ~
149
150 Concealing is set for some syntax.
151
152 For example, conceal '[link text](link url)' as just 'link text'.
153
154 To enable conceal use Vim's standard conceal configuration.
155 >
156   set conceallevel=2
157 <
158 To disable conceal regardless of 'conceallevel' setting, add the following to
159 your '.vimrc':
160 >
161   let g:vim_markdown_conceal = 0
162 <
163 -------------------------------------------------------------------------------
164                                      *vim-markdown-fenced-code-block-languages*
165 Fenced code block languages ~
166
167 You can use filetype name as fenced code block languages for syntax
168 highlighting. If you want to use different name from filetype, you can add it
169 in your '.vimrc' like so:
170 >
171   let g:vim_markdown_fenced_languages = ['csharp=cs']
172 <
173 This will cause the following to be highlighted using the 'cs' filetype syntax.
174 >
175   ```csharp
176   ...
177   ```
178 <
179 Default is "['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini']".
180
181 -------------------------------------------------------------------------------
182                                                *vim-markdown-syntax-extensions*
183 Syntax extensions ~
184
185 The following options control which syntax extensions will be turned on. They
186 are off by default.
187
188 -------------------------------------------------------------------------------
189                                                       *vim-markdown-latex-math*
190 LaTeX math ~
191
192 Used as '$x^2$', '$$x^2$$', escapable as '\$x\$' and '\$\$x\$\$'.
193 >
194   let g:vim_markdown_math = 1
195 <
196 -------------------------------------------------------------------------------
197                                                *vim-markdown-yaml-front-matter*
198 YAML Front Matter ~
199
200 Highlight YAML front matter as used by Jekyll or Hugo [7].
201 >
202   let g:vim_markdown_frontmatter = 1
203 <
204 -------------------------------------------------------------------------------
205                                                *vim-markdown-toml-front-matter*
206 TOML Front Matter ~
207
208 Highlight TOML front matter as used by Hugo [7].
209
210 TOML syntax highlight requires vim-toml [8].
211 >
212   let g:vim_markdown_toml_frontmatter = 1
213 <
214 -------------------------------------------------------------------------------
215                                                *vim-markdown-json-front-matter*
216 JSON Front Matter ~
217
218 Highlight JSON front matter as used by Hugo [7].
219
220 JSON syntax highlight requires vim-json [9].
221 >
222   let g:vim_markdown_json_frontmatter = 1
223 <
224 -------------------------------------------------------------------------------
225                                      *vim-markdown-adjust-new-list-item-indent*
226 Adjust new list item indent ~
227
228 You can adjust a new list indent. For example, you insert a single line like
229 below:
230 >
231   * item1
232 <
233 Then if you type 'o' to insert new line in vim and type '* item2', the result
234 will be:
235 >
236   * item1
237       * item2
238 <
239 vim-markdown automatically insert the indent. By default, the number of spaces
240 of indent is 4. If you'd like to change the number as 2, just write:
241 >
242   let g:vim_markdown_new_list_item_indent = 2
243 <
244 ===============================================================================
245                                                         *vim-markdown-mappings*
246 Mappings ~
247
248 The following work on normal and visual modes:
249
250                                                               *vim-markdown-gx*
251 - 'gx': open the link under the cursor in the same browser as the standard
252   'gx' command. '<Plug>Markdown_OpenUrlUnderCursor'
253
254   The standard 'gx' is extended by allowing you to put your cursor anywhere
255   inside a link.
256
257   For example, all the following cursor positions will work:
258 >
259   [Example](http://example.com)
260   ^  ^    ^^   ^       ^
261   1  2    34   5       6
262
263   <http://example.com>
264   ^  ^               ^
265   1  2               3
266 <
267   Known limitation: does not work for links that span multiple lines.
268
269                                                               *vim-markdown-ge*
270 - 'ge': open the link under the cursor in Vim for editing. Useful for
271   relative markdown links. '<Plug>Markdown_EditUrlUnderCursor'
272
273   The rules for the cursor position are the same as the 'gx' command.
274
275                                                               *vim-markdown-]]*
276 - ']]': go to next header. '<Plug>Markdown_MoveToNextHeader'
277
278                                                               *vim-markdown-[[*
279 - '[[': go to previous header. Contrast with ']c'.
280   '<Plug>Markdown_MoveToPreviousHeader'
281
282                                                               *vim-markdown-][*
283 - '][': go to next sibling header if any.
284   '<Plug>Markdown_MoveToNextSiblingHeader'
285
286                                                               *vim-markdown-[]*
287 - '[]': go to previous sibling header if any.
288   '<Plug>Markdown_MoveToPreviousSiblingHeader'
289
290                                                               *vim-markdown-]c*
291 - ']c': go to Current header. '<Plug>Markdown_MoveToCurHeader'
292
293                                                               *vim-markdown-]u*
294 - ']u': go to parent header (Up). '<Plug>Markdown_MoveToParentHeader'
295
296 This plugin follows the recommended Vim plugin mapping interface, so to change
297 the map ']u' to 'asdf', add to your '.vimrc':
298 >
299   map asdf <Plug>Markdown_MoveToParentHeader
300 <
301 To disable a map use:
302 >
303   map <Plug> <Plug>Markdown_MoveToParentHeader
304 <
305 ===============================================================================
306                                                         *vim-markdown-commands*
307 Commands ~
308
309 The following requires ':filetype plugin on'.
310
311                                                               *:HeaderDecrease*
312 - ':HeaderDecrease':
313
314   Decrease level of all headers in buffer: 'h2' to 'h1', 'h3' to 'h2', etc.
315
316   If range is given, only operate in the range.
317
318   If an 'h1' would be decreased, abort.
319
320   For simplicity of implementation, Setex headers are converted to Atx.
321
322                                                               *:HeaderIncrease*
323 - ':HeaderIncrease': Analogous to ':HeaderDecrease', but increase levels
324   instead.
325
326                                                                   *:SetexToAtx*
327 - ':SetexToAtx':
328
329   Convert all Setex style headers in buffer to Atx.
330
331   If a range is given, e.g. hit ':' from visual mode, only operate on the
332   range.
333
334                                                                  *:TableFormat*
335 - ':TableFormat': Format the table under the cursor like this [10].
336
337   Requires Tabular [11].
338
339   The input table _must_ already have a separator line as the second line of
340   the table. That line only needs to contain the correct pipes '|', nothing
341   else is required.
342
343                                                                          *:Toc*
344 - ':Toc': create a quickfix vertical window navigable table of contents with
345   the headers.
346
347   Hit '<Enter>' on a line to jump to the corresponding line of the markdown
348   file.
349
350                                                                         *:Toch*
351 - ':Toch': Same as ':Toc' but in an horizontal window.
352
353                                                                         *:Toct*
354 - ':Toct': Same as ':Toc' but in a new tab.
355
356                                                                         *:Tocv*
357 - ':Tocv': Same as ':Toc' for symmetry with ':Toch' and ':Tocv'.
358
359 ===============================================================================
360                                                          *vim-markdown-credits*
361 Credits ~
362
363 The main contributors of vim-markdown are:
364
365 - **Ben Williams** (A.K.A. **plasticboy**). The original developer of vim-
366   markdown. Homepage [12].
367
368 If you feel that your name should be on this list, please make a pull request
369 listing your contributions.
370
371 ===============================================================================
372                                                          *vim-markdown-license*
373 License ~
374
375 The MIT License (MIT)
376
377 Copyright (c) 2012 Benjamin D. Williams
378
379 Permission is hereby granted, free of charge, to any person obtaining a copy of
380 this software and associated documentation files (the "Software"), to deal in
381 the Software without restriction, including without limitation the rights to
382 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
383 of the Software, and to permit persons to whom the Software is furnished to do
384 so, subject to the following conditions:
385
386 The above copyright notice and this permission notice shall be included in all
387 copies or substantial portions of the Software.
388
389 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
390 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
391 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
392 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
393 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
394 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
395 SOFTWARE.
396
397 ===============================================================================
398                                                       *vim-markdown-references*
399 References ~
400
401 [1] http://daringfireball.net/projects/markdown/
402 [2] https://github.com/gmarik/vundle
403 [3] https://github.com/tpope/vim-pathogen
404 [4] http://packages.qa.debian.org/v/vim-addon-manager.html
405 [5] https://github.com/plasticboy/vim-markdown/archive/master.tar.gz
406 [6] https://github.com/klen/python-mode
407 [7] https://gohugo.io/content/front-matter/
408 [8] https://github.com/cespare/vim-toml
409 [9] https://github.com/elzr/vim-json
410 [10] http://www.cirosantilli.com/markdown-style-guide/#tables
411 [11] https://github.com/godlygeek/tabular
412 [12] http://plasticboy.com/
413
414 vim: ft=help