patch 8.2.3686: filetype detection often mixes up Forth and F#
Problem: Filetype detection often mixes up Forth and F#. Solution: Add a function to inspect the file contents. (Doug Kearns)
This commit is contained in:
17
runtime/autoload/dist/ft.vim
vendored
17
runtime/autoload/dist/ft.vim
vendored
@ -219,6 +219,23 @@ func dist#ft#FTe()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Distinguish between Forth and F#.
|
||||
" Provided by Doug Kearns.
|
||||
func dist#ft#FTfs()
|
||||
if exists("g:filetype_fs")
|
||||
exe "setf " . g:filetype_fs
|
||||
else
|
||||
let line = getline(nextnonblank(1))
|
||||
" comments and colon definitions
|
||||
if line =~ '^\s*\.\=( ' || line =~ '^\s*\\G\= ' || line =~ '^\\$'
|
||||
\ || line =~ '^\s*: \S'
|
||||
setf forth
|
||||
else
|
||||
setf fs
|
||||
endif
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Distinguish between HTML, XHTML and Django
|
||||
func dist#ft#FThtml()
|
||||
let n = 1
|
||||
|
||||
Reference in New Issue
Block a user