summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/ft.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:59 +0000
commitcccb21df3b4c6fe0aaa99743c418aa973aeebad0 (patch)
tree35a2d1f88d47e930fec425da1c1cb89b3ccae6e0 /runtime/autoload/dist/ft.vim
parentReleasing progress-linux version 2:9.1.0199-1~progress7.99u1. (diff)
downloadvim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.tar.xz
vim-cccb21df3b4c6fe0aaa99743c418aa973aeebad0.zip
Merging upstream version 2:9.1.0374.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--runtime/autoload/dist/ft.vim24
1 files changed, 23 insertions, 1 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 1462830..4e7d517 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -10,7 +10,9 @@ vim9script
# faster.
export def Check_inp()
- if getline(1) =~ '^\*'
+ if getline(1) =~ '%%'
+ setf tex
+ elseif getline(1) =~ '^\*'
setf abaqus
else
var n = 1
@@ -280,6 +282,10 @@ export def DtraceCheck()
enddef
export def FTdef()
+ # LaTeX def files are usually generated by docstrip, which will output '%%' in first line
+ if getline(1) =~ '%%'
+ setf tex
+ endif
if get(g:, "filetype_def", "") == "modula2" || IsModula2()
SetFiletypeModula2()
return
@@ -1292,5 +1298,21 @@ export def FTvba()
endif
enddef
+export def Detect_UCI_statements(): bool
+ # Match a config or package statement at the start of the line.
+ const config_or_package_statement = '^\s*\(\(c\|config\)\|\(p\|package\)\)\s\+\S'
+ # Match a line that is either all blank or blank followed by a comment
+ const comment_or_blank = '^\s*\(#.*\)\?$'
+
+ # Return true iff the file has a config or package statement near the
+ # top of the file and all preceding lines were comments or blank.
+ return getline(1) =~# config_or_package_statement
+ \ || getline(1) =~# comment_or_blank
+ \ && ( getline(2) =~# config_or_package_statement
+ \ || getline(2) =~# comment_or_blank
+ \ && getline(3) =~# config_or_package_statement
+ \ )
+enddef
+
# Uncomment this line to check for compilation errors early
# defcompile