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

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