pascal.vim 1.7 KB

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