summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/ft.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2021-11-27 17:22:07 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-27 17:22:07 +0000
commit3d14c0f2b964195d08b34bb43f89ec5f99255194 (patch)
tree163e4b2f4c8ec11c664d0a0bc92e41da1f87a2a8 /runtime/autoload/dist/ft.vim
parentc07f11e42fc2eac5e750bf05aa3030f9b02a22ca (diff)
patch 8.2.3686: filetype detection often mixes up Forth and F#v8.2.3686
Problem: Filetype detection often mixes up Forth and F#. Solution: Add a function to inspect the file contents. (Doug Kearns)
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r--runtime/autoload/dist/ft.vim17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 344889249b..0cbcb1bbb5 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -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