]> 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:

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