robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
9f6d693e26
master
1" Vim filetype plugin file 2" Language: METAFONT 3" Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> 4" Former Maintainers: Nikolai Weibull <now@bitwi.se> 5" Latest Revision: 2016 Oct 2 6 7if exists ( "b:did_ftplugin" ) 8finish 9endif 10let b: did_ftplugin = 1 11 12let s: cpo_save = & cpo 13set cpo & vim 14 15let b: undo_ftplugin = "setl com< cms< fo< sua< inc< def< ofu<" 16 \. "| unlet! b:match_ignorecase b:match_words b:match_skip" 17 18setlocal comments = :%commentstring = %\ %sformatoptions -= tformatoptions += cjroql2 19setlocal suffixesadd = .mf 20let & l: include = '\<input\>' 21let & l: define = '\<\%(let\|newinternal\|interim\|def\|vardef\)\>\|\<\%(primary\|secondary\|tertiary\)def\>\s*[^ .]\+' 22setlocal omnifunc = syntaxcomplete#Complete 23let g: omni_syntax_group_include_mf = 'mf\w\+' 24let g: omni_syntax_group_exclude_mf = 'mfTodoComment' 25 26let s: mp_regex = { 27 \'beginsection' : '^\s*\%(\%(\|var\|primary\|secondary\|tertiary\)def\|beginchar\|beginlogochar\)\>' , 28 \'endsection' : '^\s*\%(enddef\|endchar\)\>' , 29 \'beginblock' : '^\s*\%(begingroup\|if\|for\%(\|suffixes\|ever\)\)\>' , 30 \'endblock' : '^\s*\%(endgroup\|fi\|endfor\)\>' 31 \} 32 33function ! s: move_around ( count , what , flags , visual ) 34if a: visual 35exe "normal! gv" 36endif 37call search ( s: mp_regex [ a: what ], a: flags . 's' ) " 's' sets previous context mark 38call map ( range ( 2 , a: count ), 'search(s:mp_regex[a:what], a:flags)' ) 39endfunction 40 41 42" Move around macros. 43nnoremap <silent><buffer> [[ :< C-U > call< SID > move_around(v:count1, "beginsection", "bW", v:false)< CR > 44vnoremap <silent><buffer> [[ :< C-U > call< SID > move_around(v:count1, "beginsection", "bW", v:true)< CR > 45nnoremap <silent><buffer> ]] :< C-U > call< SID > move_around(v:count1, "beginsection", "W", v:false)< CR > 46vnoremap <silent><buffer> ]] :< C-U > call< SID > move_around(v:count1, "beginsection", "W", v:true)< CR > 47nnoremap <silent><buffer> [] :< C-U > call< SID > move_around(v:count1, "endsection", "bW", v:false)< CR > 48vnoremap <silent><buffer> [] :< C-U > call< SID > move_around(v:count1, "endsection", "bW", v:true)< CR > 49nnoremap <silent><buffer> ][ :< C-U > call< SID > move_around(v:count1, "endsection", "W", v:false)< CR > 50vnoremap <silent><buffer> ][ :< C-U > call< SID > move_around(v:count1, "endsection", "W", v:true)< CR > 51nnoremap <silent><buffer> [{ :< C-U > call< SID > move_around(v:count1, "beginblock", "bW", v:false)< CR > 52vnoremap <silent><buffer> [{ :< C-U > call< SID > move_around(v:count1, "beginblock", "bW", v:true)< CR > 53nnoremap <silent><buffer> ]} :< C-U > call< SID > move_around(v:count1, "endblock", "W", v:false)< CR > 54vnoremap <silent><buffer> ]} :< C-U > call< SID > move_around(v:count1, "endblock", "W", v:true)< CR > 55 56if exists ( "loaded_matchit" ) 57let b: match_ignorecase = 0 58let b: match_words = 59 \'\<if\>:\<else\%[if]\>:\<fi\>,' . 60 \'\<for\%(\|suffixes\|ever\)\>:\<exit\%(if\|unless\)\>:\<endfor\>,' . 61 \'\<\%(\|var\|primary\|secondary\|tertiary\)def\>:\<enddef\>,' . 62 \'\<begingroup\>:\<endgroup\>,' . 63 \'\<begin\%(logo\)\?char\>:\<endchar\>' 64" Ignore comments and strings 65let b: match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") 66\ =~# "mf\\(Comment\\|String\\)$"' 67endif 68 69let & cpo = s: cpo_save 70unlet s: cpo_save