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