vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

mermaid.vim (1937B)


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