Mercurial > vim
comparison runtime/autoload/dist/ft.vim @ 33010:fcd65e5d277a v9.0.1797
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Commit: https://github.com/vim/vim/commit/f97f6bbf56408c0c97b4ddbe81fba858d7455b0d
Author: Doug Kearns <dougkearns@gmail.com>
Date: Sun Aug 27 18:44:09 2023 +0200
patch 9.0.1797: Vimball/Visual Basic filetype detection conflict
Problem: Vimball/Visual Basic filetype detection conflict
Solution: runtime(vb): Improve Vimball and Visual Basic detection logic
Only run Vimball Archiver's BufEnter autocommand on Vimball archives.
Fixes #2694.
closes: #12899
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 27 Aug 2023 19:00:04 +0200 |
parents | 6e346800670c |
children | 3284c31289f5 |
comparison
equal
deleted
inserted
replaced
33009:e3a06d8b865e | 33010:fcd65e5d277a |
---|---|
60 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) | 60 elseif ((head =~? '\.title') || (head =~? '\.ident') || (head =~? '\.macro') || (head =~? '\.subtitle') || (head =~? '\.library')) |
61 b:asmsyntax = "vmasm" | 61 b:asmsyntax = "vmasm" |
62 endif | 62 endif |
63 enddef | 63 enddef |
64 | 64 |
65 var ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)' | 65 var ft_visual_basic_content = '\c^\s*\%(Attribute\s\+VB_Name\|Begin\s\+\%(VB\.\|{\%(\x\+-\)\+\x\+}\)\)' |
66 | 66 |
67 # See FTfrm() for Visual Basic form file detection | 67 # See FTfrm() for Visual Basic form file detection |
68 export def FTbas() | 68 export def FTbas() |
69 if exists("g:filetype_bas") | 69 if exists("g:filetype_bas") |
70 exe "setf " .. g:filetype_bas | 70 exe "setf " .. g:filetype_bas |
144 if exists("g:filetype_cls") | 144 if exists("g:filetype_cls") |
145 exe "setf " .. g:filetype_cls | 145 exe "setf " .. g:filetype_cls |
146 return | 146 return |
147 endif | 147 endif |
148 | 148 |
149 if getline(1) =~ '^\v%(\%|\\)' | 149 var line1 = getline(1) |
150 | |
151 if line1 =~ '^\v%(\%|\\)' | |
150 setf tex | 152 setf tex |
151 elseif getline(1)[0] == '#' && getline(1) =~ 'rexx' | 153 elseif line1[0] == '#' && line1 =~ 'rexx' |
152 setf rexx | 154 setf rexx |
153 elseif getline(1) == 'VERSION 1.0 CLASS' | 155 elseif line1 == 'VERSION 1.0 CLASS' |
154 setf vb | 156 setf vb |
155 else | 157 else |
156 setf st | 158 setf st |
157 endif | 159 endif |
158 enddef | 160 enddef |
319 enddef | 321 enddef |
320 | 322 |
321 export def FTfrm() | 323 export def FTfrm() |
322 if exists("g:filetype_frm") | 324 if exists("g:filetype_frm") |
323 exe "setf " .. g:filetype_frm | 325 exe "setf " .. g:filetype_frm |
326 return | |
327 endif | |
328 | |
329 if getline(1) == "VERSION 5.00" | |
330 setf vb | |
324 return | 331 return |
325 endif | 332 endif |
326 | 333 |
327 var lines = getline(1, min([line("$"), 5])) | 334 var lines = getline(1, min([line("$"), 5])) |
328 | 335 |
1195 | 1202 |
1196 # No line matched, fall back to "v". | 1203 # No line matched, fall back to "v". |
1197 setf v | 1204 setf v |
1198 enddef | 1205 enddef |
1199 | 1206 |
1207 export def FTvba() | |
1208 if getline(1) =~ '^["#] Vimball Archiver' | |
1209 setf vim | |
1210 else | |
1211 setf vb | |
1212 endif | |
1213 enddef | |
1214 | |
1200 # Uncomment this line to check for compilation errors early | 1215 # Uncomment this line to check for compilation errors early |
1201 # defcompile | 1216 # defcompile |