robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
7ed6966023
master
1" Vim filetype plugin file 2" Language: GNU Octave 3" Maintainer: Doug Kearns <dougkearns@gmail.com> 4" Last Change: 2024 Jan 14 5 6if exists ( "b:did_ftplugin" ) 7finish 8endif 9let b: did_ftplugin = 1 10 11let s: cpo_save = & cpo 12set cpo & vim 13 14" TODO: update Matlab ftplugin and source it as the base file? 15 16setlocal comments = s:%{,m:\ ,e:%},s:#{,m:\ ,e:#},:%,:# 17setlocal commentstring = #\ %s 18setlocal formatoptions -= tformatoptions += croql 19 20setlocal keywordprg = info\ octave\ --vi-keys\ --index-search 21 22if exists ( "loaded_matchit" ) && ! exists ( "b:match_words" ) 23let b: match_words = '\<unwind_protect\>:\<unwind_protect_cleanup\>:\<end_unwind_protect\>' 24if exists ( "octave_use_matlab_end" ) 25let b: match_words ..= ',' .. 26 \'\<\%(classdef\|enumeration\|events\|for\|function\|if\|methods\|parfor\|properties\|switch\|while\|try\)\>' .. 27 \':' .. 28 \'\<\%(elseif\|else\|case\|otherwise\|break\|continue\|catch\)\>' .. 29 \':' .. 30 \'\<end\>' 31else 32let b: match_words ..= ',' .. 33 \'\<classdef\>:\<endclassdef\>,' .. 34 \'\<enumeration\>:\<endenumeration\>,' .. 35 \'\<events\>:\<endevents\>,' .. 36 \'\<do\>:\<\%(break\|continue\)\>:\<until\>' .. 37 \'\<for\>:\<\%(break\|continue\)\>:\<endfor\>,' .. 38 \'\<function\>:\<return\>:\<endfunction\>,' .. 39 \'\<if\>:\<\%(elseif\|else\)\>:\<endif\>,' .. 40 \'\<methods\>:\<endmethods\>,' .. 41 \'\<parfor\>:\<endparfor\>,' .. 42 \'\<properties\>:\<endproperties\>,' .. 43 \'\<switch\>:\<\%(case\|otherwise\)\>:\<endswitch\>,' .. 44 \'\<while\>:\<\%(break\|continue\)\>:\<endwhile\>,' .. 45 \'\<try\>:\<catch\>:\<end_try_catch\>' 46endif 47" only match in statement position 48let s: statement_start = escape ( '\%(\%(^\|;\)\s*\)\@<=' , '\' ) 49let b: match_words = substitute ( b: match_words , '\\<' , s: statement_start , 'g' ) 50endif 51 52if ( has ( "gui_win32" ) || has ( "gui_gtk" )) && ! exists ( "b:browsefilter" ) 53let b: browsefilter = "GNU Octave Source Files (*.m)\t*.m\n" 54if has ( "win32" ) 55let b: browsefilter ..= "All Files (*.*)\t*\n" 56else 57let b: browsefilter ..= "All Files (*)\t*\n" 58endif 59endif 60 61let b: undo_ftplugin = "setl com< cms< fo< kp< " .. 62 \"| unlet! b:browsefilter b:match_words" 63 64let & cpo = s: cpo_save 65unlet s: cpo_save 66 67" vim: nowrap sw=2 sts=2 ts=8 noet: