mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
patch 8.2.4274: Basic and form filetype detection is incomplete
Problem: Basic and form filetype detection is incomplete. Solution: Add a separate function for .frm files. (Doug Kearns, closes #9675)
This commit is contained in:
committed by
Bram Moolenaar
parent
c4573eb12d
commit
c570e9cf68
24
runtime/autoload/dist/ft.vim
vendored
24
runtime/autoload/dist/ft.vim
vendored
@ -67,7 +67,10 @@ func dist#ft#FTasmsyntax()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTbas(alt = '')
|
||||
let s:ft_visual_basic_content = '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)'
|
||||
|
||||
" See FTfrm() for Visual Basic form file detection
|
||||
func dist#ft#FTbas()
|
||||
if exists("g:filetype_bas")
|
||||
exe "setf " . g:filetype_bas
|
||||
return
|
||||
@ -86,10 +89,8 @@ func dist#ft#FTbas(alt = '')
|
||||
setf freebasic
|
||||
elseif match(lines, qb64_preproc) > -1
|
||||
setf qb64
|
||||
elseif match(lines, '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)') > -1
|
||||
elseif match(lines, s:ft_visual_basic_content) > -1
|
||||
setf vb
|
||||
elseif a:alt != ''
|
||||
exe 'setf ' .. a:alt
|
||||
else
|
||||
setf basic
|
||||
endif
|
||||
@ -237,6 +238,21 @@ func dist#ft#FTe()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTfrm()
|
||||
if exists("g:filetype_frm")
|
||||
exe "setf " . g:filetype_frm
|
||||
return
|
||||
endif
|
||||
|
||||
let lines = getline(1, min([line("$"), 5]))
|
||||
|
||||
if match(lines, s:ft_visual_basic_content) > -1
|
||||
setf vb
|
||||
else
|
||||
setf form
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Distinguish between Forth and F#.
|
||||
" Provided by Doug Kearns.
|
||||
func dist#ft#FTfs()
|
||||
|
Reference in New Issue
Block a user