blob: 9c1acc276ad435be43e519c29f90081e5a81814c [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
Bram Moolenaar56994d22021-04-17 16:31:09 +02005
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")
Doug Kearns93197fd2024-01-14 20:59:02 +010042 let b:browsefilter = "Modula-2 Source Files (*.def, *.mod)\t*.def;*.mod\n"
43 if has("win32")
44 let b:browsefilter ..= "All Files (*.*)\t*\n"
45 else
46 let b:browsefilter ..= "All Files (*)\t*\n"
47 endif
Doug Kearns68a89472024-01-05 17:59:04 +010048 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
Bram Moolenaar56994d22021-04-17 16:31:09 +020049endif
50
Bram Moolenaar56994d22021-04-17 16:31:09 +020051let &cpo = s:cpo_save
52unlet s:cpo_save
53
54" vim: nowrap sw=2 sts=2 ts=8 noet: