diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-02-01 08:35:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 08:35:28 +0100 |
commit | a562b5771ea91becd0a469378ec852feaf50d2d0 (patch) | |
tree | 72f9215a32c2428b40345bbea0100115db61915b /runtime/autoload | |
parent | 547497b042dccc10de0e144485d36952dbd1182e (diff) | |
download | rneovim-a562b5771ea91becd0a469378ec852feaf50d2d0.tar.gz rneovim-a562b5771ea91becd0a469378ec852feaf50d2d0.tar.bz2 rneovim-a562b5771ea91becd0a469378ec852feaf50d2d0.zip |
vim-patch:8.2.4274: Basic and form filetype detection is incomplete (#17259)
Problem: Basic and form filetype detection is incomplete.
Solution: Add a separate function for .frm files. (Doug Kearns, closes vim/vim#9675)
https://github.com/vim/vim/commit/c570e9cf68c0fe30366e82c96be460047dd659b9
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/ft.vim | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index f513a2ac8f..5d8734a625 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -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() |