install:
mkdir -pv ${ADDONS}/ftdetect
- cp -v ftdetect/mkd.vim ${ADDONS}/ftdetect/mkd.vim
+ cp -v ftdetect/markdown.vim ${ADDONS}/ftdetect/markdown.vim
mkdir -pv ${ADDONS}/ftplugin
- cp -v ftplugin/mkd.vim ${ADDONS}/ftplugin/mkd.vim
+ cp -v ftplugin/markdown.vim ${ADDONS}/ftplugin/markdown.vim
mkdir -pv ${ADDONS}/syntax
- cp -v syntax/mkd.vim ${ADDONS}/syntax/mkd.vim
+ cp -v syntax/markdown.vim ${ADDONS}/syntax/markdown.vim
mkdir -pv ${ADDONS}/after/ftplugin
- cp -v after/ftplugin/mkd.vim ${ADDONS}/after/ftplugin/mkd.vim
+ cp -v after/ftplugin/markdown.vim ${ADDONS}/after/ftplugin/markdown.vim
mkdir -pv ${REGISTRY}
- cp -v registry/mkd.yaml ${REGISTRY}/mkd.yaml
+ cp -v registry/markdown.yaml ${REGISTRY}/markdown.yaml
git clone https://github.com/plasticboy/vim-markdown.git
cd vim-markdown
sudo make install
-vim-addon-manager install mkd
+vim-addon-manager install markdown
```
If you are not using any package manager, download the [tarball](https://github.com/plasticboy/vim-markdown/archive/master.tar.gz) and do this:
if exists("b:did_indent") | finish | endif
let b:did_indent = 1
-setlocal indentexpr=GetMkdIndent()
+setlocal indentexpr=GetMarkdownIndent()
setlocal nolisp
setlocal autoindent
" Only define the function once
-if exists("*GetMkdIndent") | finish | endif
+if exists("*GetMarkdownIndent") | finish | endif
function! s:is_li_start(line)
return a:line !~ '^ *\([*-]\)\%( *\1\)\{2}\%( \|\1\)*$' &&
return i
endfunction
-function GetMkdIndent()
+function GetMarkdownIndent()
let list_ind = 4
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
--- /dev/null
+addon: markdown
+description: "Markdown syntax highlighting"
+files:
+ - ftdetect/markdown.vim
+ - ftplugin/markdown.vim
+ - syntax/markdown.vim
+ - after/ftplugin/markdown.vim
+++ /dev/null
-addon: mkd
-description: "Markdown syntax highlighting"
-files:
- - ftdetect/mkd.vim
- - ftplugin/mkd.vim
- - syntax/mkd.vim
- - after/ftplugin/mkd.vim
-Given mkd;
+Given markdown;
a <http://b> c
Execute (gx autolink):
let b:url = 'http://b'
let b:line = getline(1)
- let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition')
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '<') + 1), b:url
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, '>') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
-Given mkd;
+Given markdown;
a http://b.bb c
Execute (gx implicit autolink):
let b:url = 'http://b.bb'
let b:line = getline(1)
- let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition')
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
-Given mkd;
+Given markdown;
[a]: http://b "c"
Execute (gx link reference definition):
let b:url = 'http://b'
let b:line = getline(1)
- let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition')
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
" TODO would be cool if all of the following gave the link.
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, 'h') + 1), b:url
AssertEqual b:func(1, match(b:line, 'c') + 1), ''
-Given mkd;
+Given markdown;
a [b](c) d
Execute (gx autolink):
let b:url = 'c'
let b:line = getline(1)
- let b:func = Markdown_GetFunc('vim-markdown/ftplugin/mkd.vim', 'Markdown_GetUrlForPosition')
+ let b:func = Markdown_GetFunc('vim-markdown/ftplugin/markdown.vim', 'Markdown_GetUrlForPosition')
AssertEqual b:func(1, match(b:line, 'a') + 1), ''
AssertEqual b:func(1, match(b:line, '[') + 1), b:url
AssertEqual b:func(1, match(b:line, 'b') + 1), b:url
AssertEqual b:func(1, match(b:line, ')') + 1), b:url
AssertEqual b:func(1, match(b:line, 'd') + 1), ''
-Given mkd;
+Given markdown;
# a
b
normal [[
AssertEqual line('.'), 1
-Given mkd;
+Given markdown;
# a
b
normal [[
AssertEqual line('.'), 1
-Given mkd;
+Given markdown;
# a
b
normal []
AssertEqual line('.'), 1
-Given mkd;
+Given markdown;
# a
b
normal ]c
AssertEqual line('.'), 1
-Given mkd;
+Given markdown;
# a
Execute (Toc does not set nomodifiable on other files):
-Given mkd;
+Given markdown;
a **b** c
Execute (bold):
AssertEqual SyntaxOf('b'), 'htmlBold'
AssertNotEqual SyntaxOf('c'), 'htmlBold'
-Given mkd;
+Given markdown;
a *b* c
Execute (italic):
# Links
-Given mkd;
+Given markdown;
[a](b)
Execute (link with title):
AssertEqual SyntaxOf('a'), 'mkdLink'
AssertEqual SyntaxOf('b'), 'mkdURL'
-Given mkd;
+Given markdown;
(a)
(b)
AssertNotEqual SyntaxOf('a'), 'mkdURL'
AssertNotEqual SyntaxOf('b'), 'mkdURL'
-Given mkd;
+Given markdown;
[a](b) c [d](e)
Execute (multiple links on a line):
# Autolinks
-Given mkd;
+Given markdown;
a <http://b> c
Execute (autolink):
AssertEqual SyntaxOf('>'), 'mkdDelimiter'
AssertNotEqual SyntaxOf('c'), 'mkdInlineURL'
-Given mkd;
+Given markdown;
<HtTp://a>
Execute (autolink with scheme case is insensitive):
AssertEqual SyntaxOf('a'), 'mkdInlineURL'
-Given mkd;
+Given markdown;
<notascheme://a>
Execute (autolink without known scheme is not a link):
AssertNotEqual SyntaxOf('n'), 'mkdInlineURL'
-Given mkd;
+Given markdown;
<a>
Execute (autolink without scheme is not a link):
AssertNotEqual SyntaxOf('a'), 'mkdInlineURL'
-Given mkd;
+Given markdown;
< http://a >
<http://b c>
<http://d
AssertNotEqual SyntaxOf('d'), 'mkdInlineURL'
AssertNotEqual SyntaxOf('e'), 'mkdInlineURL'
-Given mkd;
+Given markdown;
\<http://a>
Execute (autolinks can be backslash escaped):
# Code Blocks
-Given mkd;
+Given markdown;
~~~
code
~~~
Execute (code blocks can be fenced with tildes):
AssertEqual SyntaxOf('c'), 'mkdCode'
-Given mkd;
+Given markdown;
~~~ruby
code
~~~
# Math
-Given mkd;
+Given markdown;
a $x$ b
c $$y$$ d
\$e\$
AssertNotEqual SyntaxOf('x'), 'mkdMath'
AssertNotEqual SyntaxOf('y'), 'mkdMath'
-Given mkd;
+Given markdown;
a
$
# YAML frontmatter
-Given mkd;
+Given markdown;
---
a: b
---
syn off | syn on
AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'
-Given mkd;
+Given markdown;
---
a: b
syn off | syn on
AssertNotEqual SyntaxOf('a'), 'yamlBlockMappingKey'
-Given mkd;
+Given markdown;
---
a: b
---