pascal.vim 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. " Vim filetype plugin file
  2. " Language: Pascal
  3. " Maintainer: Doug Kearns <dougkearns@gmail.com>
  4. " Previous Maintainer: Dan Sharp
  5. " Last Change: 2021 Apr 23
  6. if exists("b:did_ftplugin") | finish | endif
  7. let b:did_ftplugin = 1
  8. let s:cpo_save = &cpo
  9. set cpo&vim
  10. set comments=s:(*,m:\ ,e:*),s:{,m:\ ,e:}
  11. set commentstring={%s}
  12. if exists("pascal_delphi")
  13. set comments+=:///
  14. endif
  15. if !exists("pascal_traditional")
  16. set commentstring=//\ %s
  17. set comments+=://
  18. endif
  19. setlocal formatoptions-=t formatoptions+=croql
  20. if exists("loaded_matchit")
  21. let b:match_ignorecase = 1 " (Pascal is case-insensitive)
  22. let b:match_words = '\<\%(asm\|begin\|case\|\%(\%(=\|packed\)\s*\)\@<=\%(class\|object\)\|\%(=\s*\)\@<=interface\|record\|try\)\>'
  23. let b:match_words .= ':\%(^\s*\)\@<=\%(except\|finally\|else\|otherwise\)\>'
  24. let b:match_words .= ':\<end\>\.\@!'
  25. let b:match_words .= ',\<repeat\>:\<until\>'
  26. " let b:match_words .= ',\<if\>:\<else\>' " FIXME - else clashing with middle else. It seems like a debatable use anyway.
  27. let b:match_words .= ',\<unit\>:\<\%(\%(^\s*\)\@<=interface\|implementation\|initialization\|finalization\)\>:\<end\.'
  28. endif
  29. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
  30. let b:browsefilter = "Pascal Source Files (*.pas *.pp *.inc)\t*.pas;*.pp;*.inc\n" .
  31. \ "All Files (*.*)\t*.*\n"
  32. endif
  33. let b:undo_ftplugin = "setl fo< cms< com< " ..
  34. \ "| unlet! b:browsefilter b:match_words b:match_ignorecase"
  35. let &cpo = s:cpo_save
  36. unlet s:cpo_save
  37. " vim: nowrap sw=2 sts=2 ts=8 noet: