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