modula2.vim 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. if exists("b:did_ftplugin")
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let s:cpo_save = &cpo
  11. set cpo&vim
  12. let s:dialect = modula2#GetDialect()
  13. if s:dialect ==# "r10"
  14. setlocal comments=s:(*,m:\ ,e:*),:!
  15. setlocal commentstring=!\ %s
  16. else
  17. setlocal commentstring=(*\ %s\ *)
  18. setlocal comments=s:(*,m:\ ,e:*)
  19. endif
  20. setlocal formatoptions-=t formatoptions+=croql
  21. let b:undo_ftplugin = "setl com< cms< fo<"
  22. if exists("loaded_matchit") && !exists("b:match_words")
  23. let b:match_ignorecase = 0
  24. " the second branch of the middle pattern is intended to match CASE labels
  25. let b:match_words = '\<REPEAT\>:\<UNTIL\>,' ..
  26. \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\|RECORD\)\>' ..
  27. \ ':' ..
  28. \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' ..
  29. \ ':' ..
  30. \ '\<END\>,' ..
  31. \ '(\*:\*),<\*:\*>'
  32. let b:match_skip = 's:Comment\|Pragma'
  33. let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
  34. endif
  35. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  36. let b:browsefilter = "Modula-2 Source Files (*.def, *.mod)\t*.def;*.mod\n"
  37. if has("win32")
  38. let b:browsefilter ..= "All Files (*.*)\t*\n"
  39. else
  40. let b:browsefilter ..= "All Files (*)\t*\n"
  41. endif
  42. let b:undo_ftplugin ..= " | unlet! b:browsefilter"
  43. endif
  44. let &cpo = s:cpo_save
  45. unlet s:cpo_save
  46. " vim: nowrap sw=2 sts=2 ts=8 noet: