blob: e230636acc083cb6b839c39ec6c2c7ca1ebe09f8 [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>
4" Last Change: 2021 Apr 08
5
6if exists("b:did_ftplugin")
7 finish
8endif
9let b:did_ftplugin = 1
10
11let s:cpo_save = &cpo
12set cpo&vim
13
Doug Kearns68a89472024-01-05 17:59:04 +010014let s:dialect = modula2#GetDialect()
15
16if s:dialect ==# "r10"
17 setlocal comments=s:(*,m:\ ,e:*),:!
18 setlocal commentstring=!\ %s
19else
20 setlocal commentstring=(*%s*)
21 setlocal comments=s:(*,m:\ ,e:*)
22endif
Bram Moolenaar56994d22021-04-17 16:31:09 +020023setlocal formatoptions-=t formatoptions+=croql
24
Doug Kearns68a89472024-01-05 17:59:04 +010025let b:undo_ftplugin = "setl com< cms< fo<"
26
Bram Moolenaar56994d22021-04-17 16:31:09 +020027if exists("loaded_matchit") && !exists("b:match_words")
Doug Kearns68a89472024-01-05 17:59:04 +010028 let b:match_ignorecase = 0
29 " the second branch of the middle pattern is intended to match CASE labels
Bram Moolenaar56994d22021-04-17 16:31:09 +020030 let b:match_words = '\<REPEAT\>:\<UNTIL\>,' ..
Doug Kearns68a89472024-01-05 17:59:04 +010031 \ '\<\%(BEGIN\|CASE\|FOR\|IF\|LOOP\|WHILE\|WITH\|RECORD\)\>' ..
32 \ ':' ..
33 \ '\<\%(ELSIF\|ELSE\)\>\|\%(^\s*\)\@<=\w\+\%(\s*\,\s*\w\+\)\=\s*\:=\@!' ..
34 \ ':' ..
35 \ '\<END\>,' ..
36 \ '(\*:\*),<\*:\*>'
37 let b:match_skip = 's:Comment\|Pragma'
38 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
Bram Moolenaar56994d22021-04-17 16:31:09 +020039endif
40
41if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
42 let b:browsefilter = "Modula-2 Source Files (*.def *.mod)\t*.def;*.mod\n" ..
Doug Kearns68a89472024-01-05 17:59:04 +010043 \ "All Files (*.*)\t*.*\n"
44 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
Bram Moolenaar56994d22021-04-17 16:31:09 +020045endif
46
Bram Moolenaar56994d22021-04-17 16:31:09 +020047let &cpo = s:cpo_save
48unlet s:cpo_save
49
50" vim: nowrap sw=2 sts=2 ts=8 noet: