modula2.vim (1577B)
1 " Vim filetype plugin file 2 " Language: Modula-2 3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 4 " Last Change: 2024 Jan 14 5 " 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') 6 7 if exists("b:did_ftplugin") 8 finish 9 endif 10 let b:did_ftplugin = 1 11 12 let s:cpo_save = &cpo 13 set cpo&vim 14 15 let s:dialect = modula2#GetDialect() 16 17 if s:dialect ==# "r10" 18 setlocal comments=s:(*,m:\ ,e:*),:! 19 setlocal commentstring=!\ %s 20 else 21 setlocal commentstring=(*\ %s\ *) 22 setlocal comments=s:(*,m:\ ,e:*) 23 endif 24 setlocal formatoptions-=t formatoptions+=croql 25 26 let b:undo_ftplugin = "setl com< cms< fo<" 27 28 if exists("loaded_matchit") && !exists("b:match_words") 29 let b:match_ignorecase = 0 30 " the second branch of the middle pattern is intended to match CASE labels 31 let b:match_words = '\<REPEAT\>:\<UNTIL\>,' .. 32 \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\|RECORD\)\>' .. 33 \ ':' .. 34 \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' .. 35 \ ':' .. 36 \ '\<END\>,' .. 37 \ '(\*:\*),<\*:\*>' 38 let b:match_skip = 's:Comment\|Pragma' 39 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words" 40 endif 41 42 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") 43 let b:browsefilter = "Modula-2 Source Files (*.def, *.mod)\t*.def;*.mod\n" 44 if has("win32") 45 let b:browsefilter ..= "All Files (*.*)\t*\n" 46 else 47 let b:browsefilter ..= "All Files (*)\t*\n" 48 endif 49 let b:undo_ftplugin ..= " | unlet! b:browsefilter" 50 endif 51 52 let &cpo = s:cpo_save 53 unlet s:cpo_save 54 55 " vim: nowrap sw=2 sts=2 ts=8 noet: