aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-01-11 21:02:58 +0100
committerGitHub <noreply@github.com>2022-01-11 21:02:58 +0100
commit70fe3ce004f1c17328257349da5528757fdcd354 (patch)
tree06c62d6fe6629d527d34c84541d9ff89be0bdaad /runtime/autoload
parent074b033e7e10baf3f4401a1652c1de197f5b5c4e (diff)
downloadrneovim-70fe3ce004f1c17328257349da5528757fdcd354.tar.gz
rneovim-70fe3ce004f1c17328257349da5528757fdcd354.tar.bz2
rneovim-70fe3ce004f1c17328257349da5528757fdcd354.zip
vim-patch:8.2.4064: foam files are not detected (#17041)
* vim-patch:8.2.4064: foam files are not detected Problem: Foam files are not detected. Solution: Detect the foam filetype by the path and file contents. (Mohammed Elwardi Fadeli, closes vim/vim#9501) https://github.com/vim/vim/commit/2284f6cca384e0ccc352bfec7277dc26386cac3d * Port foam ft detection to filetype.lua Co-authored-by: Gregory Anders <greg@gpanders.com>
Diffstat (limited to 'runtime/autoload')
-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 9933ace8c2..342731b272 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -829,6 +829,23 @@ func dist#ft#Dep3patch()
endfor
endfunc
+" This function checks the first 15 lines for appearance of 'FoamFile'
+" and then 'object' in a following line.
+" In that case, it's probably an OpenFOAM file
+func dist#ft#FTfoam()
+ let ffile = 0
+ let lnum = 1
+ while lnum <= 15
+ if getline(lnum) =~# '^FoamFile'
+ let ffile = 1
+ elseif ffile == 1 && getline(lnum) =~# '^\s*object'
+ setf foam
+ return
+ endif
+ let lnum = lnum + 1
+ endwhile
+endfunc
+
" Restore 'cpoptions'
let &cpo = s:cpo_save
unlet s:cpo_save