mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.0.1773: cannot distinguish Forth and Fortran *.f files
Problem: cannot distinguish Forth and Fortran *.f files Solution: Add Filetype detection Code Also add *.4th as a Forth filetype closes: #12251 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Doug Kearns <dougkearns@gmail.com>
This commit is contained in:
committed by
Christian Brabandt
parent
6633611f42
commit
19a3bc3add
@@ -246,7 +246,7 @@ def s:GetFilenameChecks(): dict<list<string>>
|
||||
fish: ['file.fish'],
|
||||
focexec: ['file.fex', 'file.focexec'],
|
||||
form: ['file.frm'],
|
||||
forth: ['file.ft', 'file.fth'],
|
||||
forth: ['file.ft', 'file.fth', 'file.4th'],
|
||||
fortran: ['file.f', 'file.for', 'file.fortran', 'file.fpp', 'file.ftn', 'file.f77', 'file.f90', 'file.f95', 'file.f03', 'file.f08'],
|
||||
fpcmake: ['file.fpc'],
|
||||
framescript: ['file.fsl'],
|
||||
@@ -1265,6 +1265,54 @@ func Test_ex_file()
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
func Test_f_file()
|
||||
filetype on
|
||||
|
||||
call writefile(['looks like Fortran'], 'Xfile.f', 'D')
|
||||
split Xfile.f
|
||||
call assert_equal('fortran', &filetype)
|
||||
bwipe!
|
||||
|
||||
let g:filetype_f = 'forth'
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
unlet g:filetype_f
|
||||
|
||||
" Test dist#ft#FTf()
|
||||
|
||||
" Forth
|
||||
|
||||
call writefile(['( Forth inline comment )'], 'Xfile.f')
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
call writefile(['\ Forth line comment'], 'Xfile.f')
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
call writefile([': squared ( n -- n^2 )', 'dup * ;'], 'Xfile.f')
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
" SwiftForth
|
||||
|
||||
call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.f')
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.f')
|
||||
split Xfile.f
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
func Test_foam_file()
|
||||
filetype on
|
||||
call assert_true(mkdir('0', 'pR'))
|
||||
@@ -1355,7 +1403,7 @@ func Test_fs_file()
|
||||
|
||||
" Test dist#ft#FTfs()
|
||||
|
||||
" Forth (Gforth)
|
||||
" Forth
|
||||
|
||||
call writefile(['( Forth inline comment )'], 'Xfile.fs')
|
||||
split Xfile.fs
|
||||
@@ -1372,6 +1420,18 @@ func Test_fs_file()
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
" SwiftForth
|
||||
|
||||
call writefile(['{ ================', 'Header comment', '================ }'], 'Xfile.fs')
|
||||
split Xfile.fs
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
call writefile(['OPTIONAL Maybe Descriptive text'], 'Xfile.fs')
|
||||
split Xfile.fs
|
||||
call assert_equal('forth', &filetype)
|
||||
bwipe!
|
||||
|
||||
filetype off
|
||||
endfunc
|
||||
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1773,
|
||||
/**/
|
||||
1772,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user