blob: 306688da05066113344721131f4d19e0bc16314e [file] [log] [blame]
Bram Moolenaar56994d22021-04-17 16:31:09 +02001" Vim filetype plugin file
2" Language: Modula-2
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
Doug Kearns93197fd2024-01-14 20:59:02 +01004" Last Change: 2024 Jan 14
Riley Bruins0a083062024-06-03 20:40:45 +02005" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')
Bram Moolenaar56994d22021-04-17 16:31:09 +02006
7if exists("b:did_ftplugin")
8 finish
9endif
10let b:did_ftplugin = 1
11
12let s:cpo_save = &cpo
13set cpo&vim
14
Doug Kearns68a89472024-01-05 17:59:04 +010015let s:dialect = modula2#GetDialect()
16
17if s:dialect ==# "r10"
18 setlocal comments=s:(*,m:\ ,e:*),:!
19 setlocal commentstring=!\ %s
20else
Riley Bruins0a083062024-06-03 20:40:45 +020021 setlocal commentstring=(*\ %s\ *)
Doug Kearns68a89472024-01-05 17:59:04 +010022 setlocal comments=s:(*,m:\ ,e:*)
23endif
Bram Moolenaar56994d22021-04-17 16:31:09 +020024setlocal formatoptions-=t formatoptions+=croql
25
Doug Kearns68a89472024-01-05 17:59:04 +010026let b:undo_ftplugin = "setl com< cms< fo<"
27
Bram Moolenaar56994d22021-04-17 16:31:09 +020028if exists("loaded_matchit") && !exists("b:match_words")
Doug Kearns68a89472024-01-05 17:59:04 +010029 let b:match_ignorecase = 0
30 " the second branch of the middle pattern is intended to match CASE labels
Bram Moolenaar56994d22021-04-17 16:31:09 +020031 let b:match_words = '\<REPEAT\>:\<UNTIL\>,' ..
Doug Kearns68a89472024-01-05 17:59:04 +010032 \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\|RECORD\)\>' ..
33 \ ':' ..
34 \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' ..
35 \ ':' ..
36 \ '\<END\>,' ..
37 \ '(\*:\*),<\*:\*>'
38 let b:match_skip = 's:Comment\|Pragma'
39 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
Bram Moolenaar56994d22021-04-17 16:31:09 +020040endif
41
42if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
Doug Kearns93197fd2024-01-14 20:59:02 +010043 let b:browsefilter = "Modula-2 Source Files (*.def, *.mod)\t*.def;*.mod\n"
44 if has("win32")
45 let b:browsefilter ..= "All Files (*.*)\t*\n"
46 else
47 let b:browsefilter ..= "All Files (*)\t*\n"
48 endif
Doug Kearns68a89472024-01-05 17:59:04 +010049 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
Bram Moolenaar56994d22021-04-17 16:31:09 +020050endif
51
Bram Moolenaar56994d22021-04-17 16:31:09 +020052let &cpo = s:cpo_save
53unlet s:cpo_save
54
55" vim: nowrap sw=2 sts=2 ts=8 noet: