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

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