blob: 9abd7dd382fa9af250bbf9eb1cd6b7700171f0c9 [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>
Bram Moolenaar1588bc82022-03-08 21:35:07 +00004" Previous Maintainer: Dan Sharp
Doug Kearns93197fd2024-01-14 20:59:02 +01005" Last Change: 2024 Jan 14
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")
Doug Kearns93197fd2024-01-14 20:59:02 +010040 let b:browsefilter = "Pascal Source Files (*.pas, *.pp, *.inc)\t*.pas;*.pp;*.inc\n"
41 if has("win32")
42 let b:browsefilter ..= "All Files (*.*)\t*\n"
43 else
44 let b:browsefilter ..= "All Files (*)\t*\n"
45 endif
Bram Moolenaar4c295022021-05-02 17:19:11 +020046endif
47
48let b:undo_ftplugin = "setl fo< cms< com< " ..
49 \ "| unlet! b:browsefilter b:match_words b:match_ignorecase"
50
51let &cpo = s:cpo_save
52unlet s:cpo_save
53
54" vim: nowrap sw=2 sts=2 ts=8 noet: