mirror of
https://github.com/amix/vimrc
synced 2024-12-21 09:23:06 +00:00
153 lines
3.4 KiB
Text
153 lines
3.4 KiB
Text
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/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 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/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 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/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 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/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, '(') + 1), b:url
|
|
AssertEqual b:func(1, match(b:line, 'c') + 1), b:url
|
|
AssertEqual b:func(1, match(b:line, ')') + 1), b:url
|
|
AssertEqual b:func(1, match(b:line, 'd') + 1), ''
|
|
|
|
Given markdown;
|
|
[ge_test.md](ge_test.md)
|
|
|
|
Execute (ge opens file):
|
|
normal ge
|
|
AssertEqual @%, 'ge_test.md'
|
|
AssertEqual getline(1), 'ge test'
|
|
|
|
Given markdown;
|
|
[ge_test](ge_test)
|
|
|
|
Execute (ge opens file without .md extensions):
|
|
let g:vim_markdown_no_extensions_in_markdown = 1
|
|
normal ge
|
|
AssertEqual @%, 'ge_test.md'
|
|
AssertEqual getline(1), 'ge test'
|
|
unlet g:vim_markdown_no_extensions_in_markdown
|
|
|
|
Given markdown;
|
|
[ge_test.md](ge_test.md)
|
|
|
|
Execute (ge does not write before opening file):
|
|
normal ia
|
|
normal l
|
|
normal ge
|
|
AssertEqual @%, 'ge_test.md'
|
|
AssertEqual getline(1), 'ge test'
|
|
|
|
Given markdown;
|
|
[ge_test.md](ge_test.md)
|
|
|
|
Execute (ge auto-write before opening file):
|
|
let g:vim_markdown_autowrite = 1
|
|
normal ia
|
|
normal l
|
|
AssertThrows normal ge
|
|
AssertEqual g:vader_exception, 'Vim(write):E382: Cannot write, ''buftype'' option is set'
|
|
unlet g:vim_markdown_autowrite
|
|
|
|
Given markdown;
|
|
# a
|
|
|
|
b
|
|
|
|
# c
|
|
|
|
d
|
|
|
|
Execute (]] same level):
|
|
AssertEqual line('.'), 1
|
|
normal ]]
|
|
AssertEqual line('.'), 5
|
|
normal [[
|
|
AssertEqual line('.'), 1
|
|
|
|
Given markdown;
|
|
# a
|
|
|
|
b
|
|
|
|
## c
|
|
|
|
d
|
|
|
|
Execute (]] different levels level):
|
|
AssertEqual line('.'), 1
|
|
normal ]]
|
|
AssertEqual line('.'), 5
|
|
normal [[
|
|
AssertEqual line('.'), 1
|
|
|
|
Given markdown;
|
|
# a
|
|
|
|
b
|
|
|
|
## c
|
|
|
|
d
|
|
|
|
# e
|
|
|
|
f
|
|
|
|
Execute (][ different levels level):
|
|
AssertEqual line('.'), 1
|
|
normal ][
|
|
AssertEqual line('.'), 9
|
|
normal []
|
|
AssertEqual line('.'), 1
|
|
|
|
Given markdown;
|
|
# a
|
|
|
|
b
|
|
|
|
Execute (]c):
|
|
normal! 3G
|
|
AssertEqual line('.'), 3
|
|
normal ]c
|
|
AssertEqual line('.'), 1
|