annotate runtime/autoload/dist/ft.vim @ 27877:834d3fba1e7c v8.2.4464

patch 8.2.4464: Dtrace files are recognized as filetype D Commit: https://github.com/vim/vim/commit/4d56b971cbae01cc454eb09713326224993e38ed Author: =?UTF-8?q?Teubel=20Gy=C3=B6rgy?= <tgyurci@gmail.com> Date: Thu Feb 24 17:59:09 2022 +0000 patch 8.2.4464: Dtrace files are recognized as filetype D Problem: Dtrace files are recognized as filetype D. Solution: Add a pattern for Dtrace files. (Teubel Gy?rgy, closes https://github.com/vim/vim/issues/9841) Add some more testing.
author Bram Moolenaar <Bram@vim.org>
date Thu, 24 Feb 2022 19:00:04 +0100
parents e63514ae0c29
children d19b7aee1925
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
1 vim9script
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
3 # Vim functions for file type detection
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
4 #
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
5 # Maintainer: Bram Moolenaar <Bram@vim.org>
27557
ce72087b601f patch 8.2.4305: tex filetype detection fails
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
6 # Last Change: 2022 Feb 05
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
8 # These functions are moved here from runtime/filetype.vim to make startup
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
9 # faster.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
11 export def Check_inp()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if getline(1) =~ '^\*'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 setf abaqus
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
15 var n = 1
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
16 var nmax = line("$") > 500 ? 500 : line("$")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 while n <= nmax
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 if getline(n) =~? "^header surface data"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 setf trasys
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 break
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
22 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
25 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
27 # This function checks for the kind of assembly that is wanted by the user, or
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
28 # can be detected from the first five lines of the file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
29 export def FTasm()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
30 # make sure b:asmsyntax exists
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 if !exists("b:asmsyntax")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
32 b:asmsyntax = ""
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 if b:asmsyntax == ""
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
36 FTasmsyntax()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
39 # if b:asmsyntax still isn't set, default to asmsyntax or GNU
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 if b:asmsyntax == ""
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 if exists("g:asmsyntax")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
42 b:asmsyntax = g:asmsyntax
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
44 b:asmsyntax = "asm"
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
48 exe "setf " .. fnameescape(b:asmsyntax)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
49 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
51 export def FTasmsyntax()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
52 # see if the file contains any asmsyntax=foo overrides. If so, change
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
53 # b:asmsyntax appropriately
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
54 var head = " " .. getline(1) .. " " .. getline(2) .. " "
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
55 .. getline(3) .. " " .. getline(4) .. " " .. getline(5) .. " "
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
56 var match = matchstr(head, '\sasmsyntax=\zs[a-zA-Z0-9]\+\ze\s')
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 if match != ''
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
58 b:asmsyntax = match
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library'))
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
60 b:asmsyntax = "vmasm"
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
62 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
64 var ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
65
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
66 # See FTfrm() for Visual Basic form file detection
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
67 export def FTbas()
27287
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
68 if exists("g:filetype_bas")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
69 exe "setf " .. g:filetype_bas
27287
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
70 return
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
71 endif
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
72
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
73 # most frequent FreeBASIC-specific keywords in distro files
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
74 var fb_keywords = '\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
75 var fb_preproc = '\c^\s*\%(#\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\)'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
76 var fb_comment = "^\\s*/'"
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
77 # OPTION EXPLICIT, without the leading underscore, is common to many dialects
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
78 var qb64_preproc = '\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)'
27287
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
79
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
80 var lines = getline(1, min([line("$"), 100]))
27287
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
81
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
82 if match(lines, fb_preproc) > -1 || match(lines, fb_comment) > -1 || match(lines, fb_keywords) > -1
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
83 setf freebasic
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
84 elseif match(lines, qb64_preproc) > -1
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
85 setf qb64
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
86 elseif match(lines, ft_visual_basic_content) > -1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 setf vb
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 else
27287
9f72ec92d361 patch 8.2.4172: filetype detection for BASIC is not optimal
Bram Moolenaar <Bram@vim.org>
parents: 27162
diff changeset
89 setf basic
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
91 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
93 export def FTbtm()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 if exists("g:dosbatch_syntax_for_btm") && g:dosbatch_syntax_for_btm
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 setf dosbatch
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 setf btm
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
99 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
101 export def BindzoneCheck(default = '')
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
102 if getline(1) .. getline(2) .. getline(3) .. getline(4)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
103 =~ '^; <<>> DiG [0-9.]\+.* <<>>\|$ORIGIN\|$TTL\|IN\s\+SOA'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 setf bindzone
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
105 elseif default != ''
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
106 exe 'setf ' .. default
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
108 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
110 export def FTlpc()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 if exists("g:lpc_syntax_for_c")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
112 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 while lnum <= 12
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 if getline(lnum) =~# '^\(//\|inherit\|private\|protected\|nosave\|string\|object\|mapping\|mixed\)'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 setf lpc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
118 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 setf c
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
122 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
124 export def FTheader()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 if exists("g:c_syntax_for_h")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 setf objc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 setf objcpp
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 elseif exists("g:c_syntax_for_h")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 setf c
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 elseif exists("g:ch_syntax_for_h")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 setf ch
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 setf cpp
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
138 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
140 # This function checks if one of the first ten lines start with a '@'. In
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
141 # that case it is probably a change file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
142 # If the first line starts with # or ! it's probably a ch file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
143 # If a line has "main", "include", "//" or "/*" it's probably ch.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
144 # Otherwise CHILL is assumed.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
145 export def FTchange()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
146 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 while lnum <= 10
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 if getline(lnum)[0] == '@'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 setf change
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 if lnum == 1 && (getline(1)[0] == '#' || getline(1)[0] == '!')
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 setf ch
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 if getline(lnum) =~ "MODULE"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 setf chill
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 if getline(lnum) =~ 'main\s*(\|#\s*include\|//'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 setf ch
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
164 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 setf chill
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
167 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
169 export def FTent()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
170 # This function checks for valid cl syntax in the first five lines.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
171 # Look for either an opening comment, '#', or a block start, '{".
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
172 # If not found, assume SGML.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
173 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 while lnum < 6
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
175 var line = getline(lnum)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 if line =~ '^\s*[#{]'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 setf cl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 elseif line !~ '^\s*$'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
180 # Not a blank line, not a comment, and not a block start,
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
181 # so doesn't look like valid cl code.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 break
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
184 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 endw
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 setf dtd
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
187 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
189 export def ExCheck()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
190 var lines = getline(1, min([line("$"), 100]))
25026
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
191 if exists('g:filetype_euphoria')
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
192 exe 'setf ' .. g:filetype_euphoria
25026
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
193 elseif match(lines, '^--\|^ifdef\>\|^include\>') > -1
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
194 setf euphoria3
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
195 else
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
196 setf elixir
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
197 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
198 enddef
25026
fda44c0b4b7b patch 8.2.3050: cannot recognize elixir files
Bram Moolenaar <Bram@vim.org>
parents: 23584
diff changeset
199
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
200 export def EuphoriaCheck()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 if exists('g:filetype_euphoria')
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
202 exe 'setf ' .. g:filetype_euphoria
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 setf euphoria3
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
206 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
208 export def DtraceCheck()
27877
834d3fba1e7c patch 8.2.4464: Dtrace files are recognized as filetype D
Bram Moolenaar <Bram@vim.org>
parents: 27845
diff changeset
209 if did_filetype()
834d3fba1e7c patch 8.2.4464: Dtrace files are recognized as filetype D
Bram Moolenaar <Bram@vim.org>
parents: 27845
diff changeset
210 # Filetype was already detected
834d3fba1e7c patch 8.2.4464: Dtrace files are recognized as filetype D
Bram Moolenaar <Bram@vim.org>
parents: 27845
diff changeset
211 return
834d3fba1e7c patch 8.2.4464: Dtrace files are recognized as filetype D
Bram Moolenaar <Bram@vim.org>
parents: 27845
diff changeset
212 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
213 var lines = getline(1, min([line("$"), 100]))
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 if match(lines, '^module\>\|^import\>') > -1
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
215 # D files often start with a module and/or import statement.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 setf d
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 elseif match(lines, '^#!\S\+dtrace\|#pragma\s\+D\s\+option\|:\S\{-}:\S\{-}:') > -1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 setf dtrace
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 setf d
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
222 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
224 export def FTe()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 if exists('g:filetype_euphoria')
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
226 exe 'setf ' .. g:filetype_euphoria
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
228 var n = 1
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
229 while n < 100 && n <= line("$")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 setf specman
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
234 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 setf eiffel
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
238 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
240 export def FTfrm()
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
241 if exists("g:filetype_frm")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
242 exe "setf " .. g:filetype_frm
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
243 return
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
244 endif
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
245
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
246 var lines = getline(1, min([line("$"), 5]))
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
247
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
248 if match(lines, ft_visual_basic_content) > -1
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
249 setf vb
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
250 else
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
251 setf form
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
252 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
253 enddef
27493
3af3dee7e5d9 patch 8.2.4274: Basic and form filetype detection is incomplete
Bram Moolenaar <Bram@vim.org>
parents: 27492
diff changeset
254
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
255 # Distinguish between Forth and F#.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
256 # Provided by Doug Kearns.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
257 export def FTfs()
26311
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
258 if exists("g:filetype_fs")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
259 exe "setf " .. g:filetype_fs
26311
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
260 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
261 var line = getline(nextnonblank(1))
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
262 # comments and colon definitions
26311
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
263 if line =~ '^\s*\.\=( ' || line =~ '^\s*\\G\= ' || line =~ '^\\$'
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
264 \ || line =~ '^\s*: \S'
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
265 setf forth
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
266 else
26344
36f3a77e4b8c patch 8.2.3703: most people call F# "fsharp" and not "fs"
Bram Moolenaar <Bram@vim.org>
parents: 26311
diff changeset
267 setf fsharp
26311
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
268 endif
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
269 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
270 enddef
26311
ce3678583211 patch 8.2.3686: filetype detection often mixes up Forth and F#
Bram Moolenaar <Bram@vim.org>
parents: 26296
diff changeset
271
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
272 # Distinguish between HTML, XHTML and Django
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
273 export def FThtml()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
274 var n = 1
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
275 while n < 10 && n <= line("$")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 if getline(n) =~ '\<DTD\s\+XHTML\s'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 setf xhtml
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 setf htmldjango
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
284 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 endwhile
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
286 setf FALLBACK html
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
287 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
289 # Distinguish between standard IDL and MS-IDL
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
290 export def FTidl()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
291 var n = 1
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
292 while n < 50 && n <= line("$")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 if getline(n) =~ '^\s*import\s\+"\(unknwn\|objidl\)\.idl"'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 setf msidl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
297 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 setf idl
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
300 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
302 # Distinguish between "default" and Cproto prototype file. */
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
303 export def ProtoCheck(default: string)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
304 # Cproto files have a comment in the first line and a function prototype in
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
305 # the second line, it always ends in ";". Indent files may also have
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
306 # comments, thus we can't match comments to see the difference.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
307 # IDL files can have a single ';' in the second line, require at least one
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
308 # chacter before the ';'.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 if getline(2) =~ '.;$'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 setf cpp
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
312 exe 'setf ' .. default
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
314 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
316 export def FTm()
25727
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
317 if exists("g:filetype_m")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
318 exe "setf " .. g:filetype_m
25727
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
319 return
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
320 endif
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
321
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
322 # excluding end(for|function|if|switch|while) common to Murphi
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
323 var octave_block_terminators = '\<end\%(_try_catch\|classdef\|enumeration\|events\|methods\|parfor\|properties\)\>'
25727
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
324
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
325 var objc_preprocessor = '^\s*#\s*\%(import\|include\|define\|if\|ifn\=def\|undef\|line\|error\|pragma\)\>'
26296
9f32ccdadd22 patch 8.2.3679: objc file detected as Octave
Bram Moolenaar <Bram@vim.org>
parents: 25794
diff changeset
326
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
327 var n = 1
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
328 var saw_comment = 0 # Whether we've seen a multiline comment leader.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 while n < 100
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
330 var line = getline(n)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 if line =~ '^\s*/\*'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
332 # /* ... */ is a comment in Objective C and Murphi, so we can't conclude
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
333 # it's either of them yet, but track this as a hint in case we don't see
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
334 # anything more definitive.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
335 saw_comment = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 endif
26296
9f32ccdadd22 patch 8.2.3679: objc file detected as Octave
Bram Moolenaar <Bram@vim.org>
parents: 25794
diff changeset
337 if line =~ '^\s*//' || line =~ '^\s*@import\>' || line =~ objc_preprocessor
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 setf objc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 endif
25794
374adc90efa5 patch 8.2.3432: octave/Matlab filetype detection does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 25727
diff changeset
341 if line =~ '^\s*\%(#\|%!\)' || line =~ '^\s*unwind_protect\>' ||
25727
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
342 \ line =~ '\%(^\|;\)\s*' .. octave_block_terminators
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
343 setf octave
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
344 return
71d3ebfb00b6 patch 8.2.3399: Octave files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 25026
diff changeset
345 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
346 # TODO: could be Matlab or Octave
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 if line =~ '^\s*%'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 setf matlab
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 if line =~ '^\s*(\*'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 setf mma
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 if line =~ '^\c\s*\(\(type\|var\)\>\|--\)'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 setf murphi
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
357 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
359 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
361
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
362 if saw_comment
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
363 # We didn't see anything definitive, but this looks like either Objective C
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
364 # or Murphi based on the comment leader. Assume the former as it is more
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
365 # common.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 setf objc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
368 # Default is Matlab
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 setf matlab
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
371 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
373 export def FTmms()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
374 var n = 1
19039
d20ed2e5a776 Update a few runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 16086
diff changeset
375 while n < 20
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
376 var line = getline(n)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 if line =~ '^\s*\(%\|//\)' || line =~ '^\*'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 setf mmix
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
381 if line =~ '^\s*#'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 setf make
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
385 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 setf mmix
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
388 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
390 # This function checks if one of the first five lines start with a dot. In
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
391 # that case it is probably an nroff file: 'filetype' is set and 1 is returned.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
392 export def FTnroff(): number
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
393 if getline(1)[0] .. getline(2)[0] .. getline(3)[0]
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
394 .. getline(4)[0] .. getline(5)[0] =~ '\.'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 setf nroff
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396 return 1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 return 0
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
399 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
401 export def FTmm()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
402 var n = 1
19968
1908e92b02fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19039
diff changeset
403 while n < 20
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
404 if getline(n) =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 setf objcpp
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
408 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 setf nroff
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
411 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
413 export def FTpl()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 if exists("g:filetype_pl")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
415 exe "setf " .. g:filetype_pl
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
417 # recognize Prolog by specific text in the first non-empty line
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
418 # require a blank after the '%' because Perl uses "%list" and "%translate"
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
419 var l = getline(nextnonblank(1))
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 setf prolog
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 setf perl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
426 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
428 export def FTinc()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 if exists("g:filetype_inc")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
430 exe "setf " .. g:filetype_inc
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
432 var lines = getline(1) .. getline(2) .. getline(3)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 if lines =~? "perlscript"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 setf aspperl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435 elseif lines =~ "<%"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 setf aspvbs
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 elseif lines =~ "<?"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 setf php
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
439 # Pascal supports // comments but they're vary rarely used for file
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
440 # headers so assume POV-Ray
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
441 elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
442 setf pascal
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
444 FTasmsyntax()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 if exists("b:asmsyntax")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
446 exe "setf " .. fnameescape(b:asmsyntax)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 setf pov
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
452 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
453
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
454 export def FTprogress_cweb()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 if exists("g:filetype_w")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
456 exe "setf " .. g:filetype_w
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 if getline(1) =~ '&ANALYZE' || getline(3) =~ '&GLOBAL-DEFINE'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 setf progress
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 setf cweb
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
463 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
464 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
466 export def FTprogress_asm()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 if exists("g:filetype_i")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
468 exe "setf " .. g:filetype_i
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
471 # This function checks for an assembly comment the first ten lines.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
472 # If not found, assume Progress.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
473 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 while lnum <= 10 && lnum < line('$')
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
475 var line = getline(lnum)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 if line =~ '^\s*;' || line =~ '^\*'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
477 FTasm()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 elseif line !~ '^\s*$' || line =~ '^/\*'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
480 # Not an empty line: Doesn't look like valid assembly code.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
481 # Or it looks like a Progress /* comment
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 break
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
484 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485 endw
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 setf progress
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
487 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
489 var ft_pascal_comments = '^\s*\%({\|(\*\|//\)'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
490 var ft_pascal_keywords = '^\s*\%(program\|unit\|library\|uses\|begin\|procedure\|function\|const\|type\|var\)\>'
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
491
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
492 export def FTprogress_pascal()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 if exists("g:filetype_p")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
494 exe "setf " .. g:filetype_p
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
497 # This function checks for valid Pascal syntax in the first ten lines.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
498 # Look for either an opening comment or a program start.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
499 # If not found, assume Progress.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
500 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501 while lnum <= 10 && lnum < line('$')
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
502 var line = getline(lnum)
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
503 if line =~ ft_pascal_comments || line =~? ft_pascal_keywords
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 setf pascal
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 elseif line !~ '^\s*$' || line =~ '^/\*'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
507 # Not an empty line: Doesn't look like valid Pascal code.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
508 # Or it looks like a Progress /* comment
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509 break
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
511 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 endw
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513 setf progress
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
514 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
515
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
516 export def FTpp()
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
517 if exists("g:filetype_pp")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
518 exe "setf " .. g:filetype_pp
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
519 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
520 var line = getline(nextnonblank(1))
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
521 if line =~ ft_pascal_comments || line =~? ft_pascal_keywords
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
522 setf pascal
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
523 else
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
524 setf puppet
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
525 endif
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
526 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
527 enddef
23584
397f95f103e8 patch 8.2.2334: Pascal-like filetypes not always detected
Bram Moolenaar <Bram@vim.org>
parents: 21991
diff changeset
528
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
529 export def FTr()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
530 var max = line("$") > 50 ? 50 : line("$")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 for n in range(1, max)
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
533 # Rebol is easy to recognize, check for that first
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 if getline(n) =~? '\<REBOL\>'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535 setf rebol
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 endfor
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 for n in range(1, max)
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
541 # R has # comments
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 if getline(n) =~ '^\s*#'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 setf r
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
546 # Rexx has /* comments */
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 if getline(n) =~ '^\s*/\*'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548 setf rexx
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551 endfor
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
553 # Nothing recognized, use user default or assume Rexx
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554 if exists("g:filetype_r")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
555 exe "setf " .. g:filetype_r
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
557 # Rexx used to be the default, but R appears to be much more popular.
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 setf r
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
560 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
562 export def McSetf()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
563 # Rely on the file to start with a comment.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
564 # MS message text files use ';', Sendmail files use '#' or 'dnl'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 for lnum in range(1, min([line("$"), 20]))
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
566 var line = getline(lnum)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 if line =~ '^\s*\(#\|dnl\)'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
568 setf m4 # Sendmail .mc file
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 elseif line =~ '^\s*;'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
571 setf msmessages # MS Message text file
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574 endfor
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 setf m4 " Default: Sendmail .mc file
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
576 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
578 # Called from filetype.vim and scripts.vim.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
579 export def SetFileTypeSH(name: string)
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
580 if did_filetype()
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
581 # Filetype was already detected
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
582 return
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
583 endif
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 if expand("<amatch>") =~ g:ft_ignore_pat
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
586 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
587 if name =~ '\<csh\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
588 # Some .sh scripts contain #!/bin/csh.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
589 SetFileTypeShell("csh")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 return
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
591 elseif name =~ '\<tcsh\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
592 # Some .sh scripts contain #!/bin/tcsh.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
593 SetFileTypeShell("tcsh")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
594 return
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
595 elseif name =~ '\<zsh\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
596 # Some .sh scripts contain #!/bin/zsh.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
597 SetFileTypeShell("zsh")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
598 return
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
599 elseif name =~ '\<ksh\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
600 b:is_kornshell = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601 if exists("b:is_bash")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
602 unlet b:is_bash
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
604 if exists("b:is_sh")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
605 unlet b:is_sh
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
606 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
607 elseif exists("g:bash_is_sh") || name =~ '\<bash\>' || name =~ '\<bash2\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
608 b:is_bash = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 if exists("b:is_kornshell")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
610 unlet b:is_kornshell
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
611 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
612 if exists("b:is_sh")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
613 unlet b:is_sh
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
614 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
615 elseif name =~ '\<sh\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
616 b:is_sh = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
617 if exists("b:is_kornshell")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
618 unlet b:is_kornshell
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
619 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
620 if exists("b:is_bash")
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621 unlet b:is_bash
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
622 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
623 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
624 SetFileTypeShell("sh")
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
625 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
626
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
627 # For shell-like file types, check for an "exec" command hidden in a comment,
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
628 # as used for Tcl.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
629 # Also called from scripts.vim, thus can't be local to this script.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
630 export def SetFileTypeShell(name: string)
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
631 if did_filetype()
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
632 # Filetype was already detected
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
633 return
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
634 endif
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 if expand("<amatch>") =~ g:ft_ignore_pat
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
636 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
637 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
638 var l = 2
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
639 while l < 20 && l < line("$") && getline(l) =~ '^\s*\(#\|$\)'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
640 # Skip empty and comment lines.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
641 l += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
643 if l < line("$") && getline(l) =~ '\s*exec\s' && getline(l - 1) =~ '^\s*#.*\\$'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
644 # Found an "exec" line after a comment with continuation
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
645 var n = substitute(getline(l), '\s*exec\s\+\([^ ]*/\)\=', '', '')
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646 if n =~ '\<tclsh\|\<wish'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647 setf tcl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
648 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
649 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
651 exe "setf " .. name
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
652 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
654 export def CSH()
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
655 if did_filetype()
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
656 # Filetype was already detected
15527
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
657 return
963dd629d19a patch 8.1.0771: some shell filetype patterns end in a star
Bram Moolenaar <Bram@vim.org>
parents: 14999
diff changeset
658 endif
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
659 if exists("g:filetype_csh")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
660 SetFileTypeShell(g:filetype_csh)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
661 elseif &shell =~ "tcsh"
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
662 SetFileTypeShell("tcsh")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
663 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
664 SetFileTypeShell("csh")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
665 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
666 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
667
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
668 var ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
669 export def FTRules()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
670 var path = expand('<amatch>:p')
21853
aab3fe874b05 patch 8.2.1476: filetype test fails on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 21849
diff changeset
671 if path =~ '/\(etc/udev/\%(rules\.d/\)\=.*\.rules\|\%(usr/\)\=lib/udev/\%(rules\.d/\)\=.*\.rules\)$'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672 setf udevrules
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675 if path =~ '^/etc/ufw/'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
676 setf conf # Better than hog
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
678 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679 if path =~ '^/\(etc\|usr/share\)/polkit-1/rules\.d'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
680 setf javascript
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
681 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
682 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
683 var config_lines: list<string>
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 try
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
685 config_lines = readfile('/etc/udev/udev.conf')
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
686 catch /^Vim\%((\a\+)\)\=:E484/
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
687 setf hog
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
688 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
689 endtry
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
690 var dir = expand('<amatch>:p:h')
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
691 for line in config_lines
27845
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
692 if line =~ ft_rules_udev_rules_pattern
e63514ae0c29 patch 8.2.4448: filetype detection is failing
Bram Moolenaar <Bram@vim.org>
parents: 27557
diff changeset
693 var udev_rules = substitute(line, ft_rules_udev_rules_pattern, '\1', "")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
694 if dir == udev_rules
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
695 setf udevrules
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
697 break
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
698 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
699 endfor
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700 setf hog
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
701 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
702
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
703 export def SQL()
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
704 if exists("g:filetype_sql")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
705 exe "setf " .. g:filetype_sql
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
706 else
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
707 setf sql
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
708 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
709 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
710
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
711 # If the file has an extension of 't' and is in a directory 't' or 'xt' then
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
712 # it is almost certainly a Perl test file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
713 # If the first line starts with '#' and contains 'perl' it's probably a Perl
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
714 # file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
715 # (Slow test) If a file contains a 'use' statement then it is almost certainly
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
716 # a Perl file.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
717 export def FTperl(): number
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
718 var dirname = expand("%:p:h:t")
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
719 if expand("%:e") == 't' && (dirname == 't' || dirname == 'xt')
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
720 setf perl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721 return 1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
722 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 if getline(1)[0] == '#' && getline(1) =~ 'perl'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
724 setf perl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 return 1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
727 var save_cursor = getpos('.')
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
728 call cursor(1, 1)
27557
ce72087b601f patch 8.2.4305: tex filetype detection fails
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
729 var has_use = search('^use\s\s*\k', 'c', 30) > 0
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12816
diff changeset
730 call setpos('.', save_cursor)
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12816
diff changeset
731 if has_use
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
732 setf perl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
733 return 1
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
734 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
735 return 0
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
736 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
737
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
738 # Choose context, plaintex, or tex (LaTeX) based on these rules:
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
739 # 1. Check the first line of the file for "%&<format>".
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
740 # 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
741 # 3. Default to "plain" or to g:tex_flavor, can be set in user's vimrc.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
742 export def FTtex()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
743 var firstline = getline(1)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
744 var format: string
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
745 if firstline =~ '^%&\s*\a\+'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
746 format = tolower(matchstr(firstline, '\a\+'))
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
747 format = substitute(format, 'pdf', '', '')
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
748 if format == 'tex'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
749 format = 'latex'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
750 elseif format == 'plaintex'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
751 format = 'plain'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
752 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
753 elseif expand('%') =~ 'tex/context/.*/.*.tex'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
754 format = 'context'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
755 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
756 # Default value, may be changed later:
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
757 format = exists("g:tex_flavor") ? g:tex_flavor : 'plain'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
758 # Save position, go to the top of the file, find first non-comment line.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
759 var save_cursor = getpos('.')
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
760 call cursor(1, 1)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
761 var firstNC = search('^\s*[^[:space:]%]', 'c', 1000)
27557
ce72087b601f patch 8.2.4305: tex filetype detection fails
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
762 if firstNC > 0
ce72087b601f patch 8.2.4305: tex filetype detection fails
Bram Moolenaar <Bram@vim.org>
parents: 27538
diff changeset
763 # Check the next thousand lines for a LaTeX or ConTeXt keyword.
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
764 var lpat = 'documentclass\>\|usepackage\>\|begin{\|newcommand\>\|renewcommand\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
765 var cpat = 'start\a\+\|setup\a\+\|usemodule\|enablemode\|enableregime\|setvariables\|useencoding\|usesymbols\|stelle\a\+\|verwende\a\+\|stel\a\+\|gebruik\a\+\|usa\a\+\|imposta\a\+\|regle\a\+\|utilisemodule\>'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
766 var kwline = search('^\s*\\\%(' .. lpat .. '\)\|^\s*\\\(' .. cpat .. '\)',
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
767 'cnp', firstNC + 1000)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
768 if kwline == 1 # lpat matched
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
769 format = 'latex'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
770 elseif kwline == 2 # cpat matched
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
771 format = 'context'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
772 endif # If neither matched, keep default set above.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
773 # let lline = search('^\s*\\\%(' . lpat . '\)', 'cn', firstNC + 1000)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
774 # let cline = search('^\s*\\\%(' . cpat . '\)', 'cn', firstNC + 1000)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
775 # if cline > 0
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
776 # let format = 'context'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
777 # endif
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
778 # if lline > 0 && (cline == 0 || cline > lline)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
779 # let format = 'tex'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
780 # endif
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
781 endif # firstNC
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
782 call setpos('.', save_cursor)
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
783 endif # firstline =~ '^%&\s*\a\+'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
784
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
785 # Translation from formats to file types. TODO: add AMSTeX, RevTex, others?
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
786 if format == 'plain'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
787 setf plaintex
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
788 elseif format == 'context'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
789 setf context
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
790 else # probably LaTeX
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
791 setf tex
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
792 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
793 return
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
794 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
795
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
796 export def FTxml()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
797 var n = 1
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
798 while n < 100 && n <= line("$")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
799 var line = getline(n)
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
800 # DocBook 4 or DocBook 5.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
801 var is_docbook4 = line =~ '<!DOCTYPE.*DocBook'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
802 var is_docbook5 = line =~ ' xmlns="http://docbook.org/ns/docbook"'
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 if is_docbook4 || is_docbook5
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
804 b:docbk_type = "xml"
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
805 if is_docbook5
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
806 b:docbk_ver = 5
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807 else
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
808 b:docbk_ver = 4
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
809 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
810 setf docbk
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
811 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
812 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
813 if line =~ 'xmlns:xbl="http://www.mozilla.org/xbl"'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
814 setf xbl
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
815 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
817 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 setf xml
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
820 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
822 export def FTy()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
823 var n = 1
16024
7fd3a9eaeedb patch 8.1.1017: off-by-one error in filetype detection
Bram Moolenaar <Bram@vim.org>
parents: 15527
diff changeset
824 while n < 100 && n <= line("$")
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
825 var line = getline(n)
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 if line =~ '^\s*%'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
827 setf yacc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
828 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
829 endif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830 if getline(n) =~ '^\s*\(#\|class\>\)' && getline(n) !~ '^\s*#\s*include'
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
831 setf racc
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
832 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
833 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
834 n += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
835 endwhile
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
836 setf yacc
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
837 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
838
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
839 export def Redif()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
840 var lnum = 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
841 while lnum <= 5 && lnum < line('$')
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
842 if getline(lnum) =~ "^\ctemplate-type:"
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
843 setf redif
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
844 return
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
845 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
846 lnum += 1
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
847 endwhile
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
848 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
849
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
850 # This function is called for all files under */debian/patches/*, make sure not
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
851 # to non-dep3patch files, such as README and other text files.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
852 export def Dep3patch()
26628
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
853 if expand('%:t') ==# 'series'
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
854 return
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
855 endif
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
856
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
857 for ln in getline(1, 100)
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
858 if ln =~# '^\%(Description\|Subject\|Origin\|Bug\|Forwarded\|Author\|From\|Reviewed-by\|Acked-by\|Last-Updated\|Applied-Upstream\):'
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
859 setf dep3patch
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
860 return
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
861 elseif ln =~# '^---'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
862 # end of headers found. stop processing
26628
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
863 return
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
864 endif
7efd8f561d04 patch 8.2.3843: dep3patch files are not recognized
Bram Moolenaar <Bram@vim.org>
parents: 26438
diff changeset
865 endfor
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
866 enddef
12816
218102da5226 patch 8.0.1285: occasional crash when using a channel
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
867
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
868 # This function checks the first 15 lines for appearance of 'FoamFile'
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
869 # and then 'object' in a following line.
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
870 # In that case, it's probably an OpenFOAM file
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
871 export def FTfoam()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
872 var ffile = 0
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
873 var lnum = 1
27070
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
874 while lnum <= 15
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
875 if getline(lnum) =~# '^FoamFile'
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
876 ffile = 1
27070
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
877 elseif ffile == 1 && getline(lnum) =~# '^\s*object'
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
878 setf foam
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
879 return
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
880 endif
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
881 lnum += 1
27070
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
882 endwhile
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
883 enddef
27070
b353bd9faec8 patch 8.2.4064: foam files are not detected
Bram Moolenaar <Bram@vim.org>
parents: 26708
diff changeset
884
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
885 # Determine if a *.tf file is TF mud client or terraform
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
886 export def FTtf()
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
887 var numberOfLines = line('$')
27420
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
888 for i in range(1, numberOfLines)
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
889 var currentLine = trim(getline(i))
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
890 var firstCharacter = currentLine[0]
27420
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
891 if firstCharacter !=? ";" && firstCharacter !=? "/" && firstCharacter !=? ""
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
892 setf terraform
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
893 return
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
894 endif
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
895 endfor
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
896 setf tf
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
897 enddef
27420
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
898
978890380129 patch 8.2.4238: *.tf file could be fileytpe "tf" or "terraform"
Bram Moolenaar <Bram@vim.org>
parents: 27287
diff changeset
899
27537
063952f68595 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 27493
diff changeset
900 # Uncomment this line to check for compilation errors early
27538
f37561549ec2 Update runtime files; use compiled functions
Bram Moolenaar <Bram@vim.org>
parents: 27537
diff changeset
901 # defcompile