31200
|
1 " Vim filetype plugin
|
|
2 " Language: Mermaid
|
|
3 " Maintainer: Craig MacEachern <https://github.com/craigmac/vim-mermaid>
|
|
4 " Last Change: 2022 Oct 13
|
|
5
|
|
6 if exists("b:did_ftplugin")
|
|
7 finish
|
|
8 endif
|
|
9
|
|
10 let s:keepcpo= &cpo
|
|
11 set cpo&vim
|
|
12
|
|
13 " Use mermaid live editor's style
|
|
14 setlocal expandtab
|
|
15 setlocal shiftwidth=2
|
|
16 setlocal softtabstop=-1
|
|
17 setlocal tabstop=4
|
|
18
|
|
19 " TODO: comments, formatlist stuff, based on what?
|
|
20 setlocal comments=b:#,fb:-
|
|
21 setlocal commentstring=#\ %s
|
|
22 setlocal formatoptions+=tcqln formatoptions-=r formatoptions-=o
|
|
23 setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+\\\|^\\[^\\ze[^\\]]\\+\\]:\\&^.\\{4\\}
|
|
24
|
|
25 if exists('b:undo_ftplugin')
|
|
26 let b:undo_ftplugin .= "|setl cms< com< fo< flp< et< ts< sts< sw<"
|
|
27 else
|
|
28 let b:undo_ftplugin = "setl cms< com< fo< flp< et< ts< sts< sw<"
|
|
29 endif
|
|
30
|
|
31 if !exists("g:no_plugin_maps") && !exists("g:no_markdown_maps")
|
|
32 nnoremap <silent><buffer> [[ :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
|
|
33 nnoremap <silent><buffer> ]] :<C-U>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
|
|
34 xnoremap <silent><buffer> [[ :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "bsW")<CR>
|
|
35 xnoremap <silent><buffer> ]] :<C-U>exe "normal! gv"<Bar>call search('\%(^#\{1,5\}\s\+\S\\|^\S.*\n^[=-]\+$\)', "sW")<CR>
|
|
36 let b:undo_ftplugin .= '|sil! nunmap <buffer> [[|sil! nunmap <buffer> ]]|sil! xunmap <buffer> [[|sil! xunmap <buffer> ]]'
|
|
37 endif
|
|
38
|
|
39 " if has("folding") && get(g:, "markdown_folding", 0)
|
|
40 " setlocal foldexpr=MarkdownFold()
|
|
41 " setlocal foldmethod=expr
|
|
42 " setlocal foldtext=MarkdownFoldText()
|
|
43 " let b:undo_ftplugin .= "|setl foldexpr< foldmethod< foldtext<"
|
|
44 " endif
|
|
45
|
|
46 let &cpo = s:keepcpo
|
|
47 unlet s:keepcpo
|
|
48
|
|
49 " vim:set sw=2:
|