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