blob: 2de92563aec01502d2ea91c13856e5a148202925 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaar4c295022021-05-02 17:19:11 +02002" Language: Pascal
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
4" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
5" Last Change: 2021 Apr 23
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7if exists("b:did_ftplugin") | finish | endif
8let b:did_ftplugin = 1
9
Bram Moolenaar4c295022021-05-02 17:19:11 +020010let s:cpo_save = &cpo
11set cpo&vim
Bram Moolenaar8e5af3e2011-04-28 19:02:44 +020012
Bram Moolenaar4c295022021-05-02 17:19:11 +020013set comments=s:(*,m:\ ,e:*),s:{,m:\ ,e:}
14set commentstring={%s}
15
16if exists("pascal_delphi")
17 set comments+=:///
Bram Moolenaar071d4272004-06-13 20:20:40 +000018endif
19
Bram Moolenaar4c295022021-05-02 17:19:11 +020020if !exists("pascal_traditional")
21 set commentstring=//\ %s
22 set comments+=://
23endif
24
25setlocal formatoptions-=t formatoptions+=croql
26
27if exists("loaded_matchit")
28 let b:match_ignorecase = 1 " (Pascal is case-insensitive)
29
30 let b:match_words = '\<\%(asm\|begin\|case\|\%(\%(=\|packed\)\s*\)\@<=\%(class\|object\)\|\%(=\s*\)\@<=interface\|record\|try\)\>'
31 let b:match_words .= ':\%(^\s*\)\@<=\%(except\|finally\|else\|otherwise\)\>'
32 let b:match_words .= ':\<end\>\.\@!'
33
34 let b:match_words .= ',\<repeat\>:\<until\>'
35 " let b:match_words .= ',\<if\>:\<else\>' " FIXME - else clashing with middle else. It seems like a debatable use anyway.
36 let b:match_words .= ',\<unit\>:\<\%(\%(^\s*\)\@<=interface\|implementation\|initialization\|finalization\)\>:\<end\.'
37endif
38
39if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
40 let b:browsefilter = "Pascal Source Files (*.pas *.pp *.inc)\t*.pas;*.pp;*.inc\n" .
41 \ "All Files (*.*)\t*.*\n"
42endif
43
44let b:undo_ftplugin = "setl fo< cms< com< " ..
45 \ "| unlet! b:browsefilter b:match_words b:match_ignorecase"
46
47let &cpo = s:cpo_save
48unlet s:cpo_save
49
50" vim: nowrap sw=2 sts=2 ts=8 noet: