mermaid.vim 1.7 KB

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