summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist/ft.vim
diff options
context:
space:
mode:
authorColin Caine <complaints@cmcaine.co.uk>2024-04-18 23:53:02 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-18 23:53:02 +0200
commit4b3fab14dbde971f15d8783e9ef125b19fdbc829 (patch)
tree54c899ae29ed12ca8ddbbd4b235faa4599dc4534 /runtime/autoload/dist/ft.vim
parent36e667ab837cd27b8c0c9df5c2db8008b2e1b76c (diff)
patch 9.1.0354: runtime(uci): No support for uci file typesv9.1.0354
Problem: runtime(uci): No support for uci file types (Wu, Zhenyu) Solution: include basic uci ftplugin and syntax plugins (Colin Caine) closes: #14575 Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu> Signed-off-by: Colin Caine <complaints@cmcaine.co.uk> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/autoload/dist/ft.vim')
-rw-r--r--runtime/autoload/dist/ft.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 05f1611b22..4e7d517931 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -1298,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