summaryrefslogtreecommitdiffstats
path: root/runtime/autoload/dist
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/autoload/dist')
-rw-r--r--runtime/autoload/dist/ft.vim47
-rw-r--r--runtime/autoload/dist/man.vim7
-rw-r--r--runtime/autoload/dist/vim.vim4
-rw-r--r--runtime/autoload/dist/vim9.vim4
4 files changed, 57 insertions, 5 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 2e93dd0d57..c8942eb3d1 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -9,6 +9,8 @@ vim9script
# These functions are moved here from runtime/filetype.vim to make startup
# faster.
+var prolog_pattern = '^\s*\(:-\|%\+\(\s\|$\)\|\/\*\)\|\.\s*$'
+
export def Check_inp()
if getline(1) =~ '%%'
setf tex
@@ -402,18 +404,38 @@ export def FTharedoc()
endif
enddef
-# Distinguish between HTML, XHTML and Django
+# Distinguish between HTML, XHTML, Django and Angular
export def FThtml()
var n = 1
+
+ # Test if the filename follows the Angular component template convention
+ # Disabled for the reasons mentioned here: #13594
+ # if expand('%:t') =~ '^.*\.component\.html$'
+ # setf htmlangular
+ # return
+ # endif
+
while n < 40 && n <= line("$")
+ # Check for Angular
+ if getline(n) =~ '@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|ng-template\|ng-content\|{{.*}}'
+ setf htmlangular
+ return
+ endif
+ # Check for XHTML
if getline(n) =~ '\<DTD\s\+XHTML\s'
setf xhtml
return
endif
+ # Check for Django
if getline(n) =~ '{%\s*\(autoescape\|block\|comment\|csrf_token\|cycle\|debug\|extends\|filter\|firstof\|for\|if\|ifchanged\|include\|load\|lorem\|now\|query_string\|regroup\|resetcycle\|spaceless\|templatetag\|url\|verbatim\|widthratio\|with\)\>\|{#\s\+'
setf htmldjango
return
endif
+ # Check for SuperHTML
+ if getline(n) =~ '<extend\|<super>'
+ setf superhtml
+ return
+ endif
n += 1
endwhile
setf FALLBACK html
@@ -449,7 +471,7 @@ export def ProtoCheck(default: string)
# recognize Prolog by specific text in the first non-empty line
# require a blank after the '%' because Perl uses "%list" and "%translate"
var lnum = getline(nextnonblank(1))
- if lnum =~ '\<prolog\>' || lnum =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || lnum =~ ':-'
+ if lnum =~ '\<prolog\>' || lnum =~ prolog_pattern
setf prolog
else
exe 'setf ' .. default
@@ -514,6 +536,25 @@ export def FTm()
endif
enddef
+export def FTmake()
+ # Check if it is a Microsoft Makefile
+ unlet! b:make_microsoft
+ var n = 1
+ while n < 1000 && n <= line('$')
+ var line = getline(n)
+ if line =~? '^\s*!\s*\(ifn\=\(def\)\=\|include\|message\|error\)\>'
+ b:make_microsoft = 1
+ break
+ elseif line =~ '^ *ifn\=\(eq\|def\)\>' || line =~ '^ *[-s]\=include\s'
+ break
+ elseif line =~ '^ *\w\+\s*[!?:+]='
+ break
+ endif
+ n += 1
+ endwhile
+ setf make
+enddef
+
export def FTmms()
var n = 1
while n < 20
@@ -628,7 +669,7 @@ export def FTpl()
# recognize Prolog by specific text in the first non-empty line
# require a blank after the '%' because Perl uses "%list" and "%translate"
var line = getline(nextnonblank(1))
- if line =~ '\<prolog\>' || line =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || line =~ ':-'
+ if line =~ '\<prolog\>' || line =~ prolog_pattern
setf prolog
else
setf perl
diff --git a/runtime/autoload/dist/man.vim b/runtime/autoload/dist/man.vim
index 708e1062b4..d9dbaf47d4 100644
--- a/runtime/autoload/dist/man.vim
+++ b/runtime/autoload/dist/man.vim
@@ -4,6 +4,7 @@
" Maintainer: SungHyun Nam <goweol@gmail.com>
" Autoload Split: Bram Moolenaar
" Last Change: 2024 Jan 17 (make it work on AIX, see #13847)
+" 2024 Jul 06 (honor command modifiers, #15117)
let s:cpo_save = &cpo
set cpo-=C
@@ -165,7 +166,9 @@ func dist#man#GetPage(cmdmods, ...)
endwhile
endif
if &filetype != "man"
- if exists("g:ft_man_open_mode")
+ if a:cmdmods =~ '\<\(tab\|vertical\|horizontal\)\>'
+ let open_cmd = a:cmdmods . ' split'
+ elseif exists("g:ft_man_open_mode")
if g:ft_man_open_mode == 'vert'
let open_cmd = 'vsplit'
elseif g:ft_man_open_mode == 'tab'
@@ -174,7 +177,7 @@ func dist#man#GetPage(cmdmods, ...)
let open_cmd = 'split'
endif
else
- let open_cmd = a:cmdmods . ' split'
+ let open_cmd = 'split'
endif
endif
endif
diff --git a/runtime/autoload/dist/vim.vim b/runtime/autoload/dist/vim.vim
index 021244c93b..d519406530 100644
--- a/runtime/autoload/dist/vim.vim
+++ b/runtime/autoload/dist/vim.vim
@@ -18,6 +18,10 @@ endif
if !has('vim9script')
function dist#vim#IsSafeExecutable(filetype, executable)
let cwd = getcwd()
+ if empty(exepath(a:executable))
+ echomsg a:executable .. " not found in $PATH"
+ return v:false
+ endif
return get(g:, a:filetype .. '_exec', get(g:, 'plugin_exec', 0)) &&
\ (fnamemodify(exepath(a:executable), ':p:h') !=# cwd
\ || (split($PATH, has('win32') ? ';' : ':')->index(cwd) != -1 &&
diff --git a/runtime/autoload/dist/vim9.vim b/runtime/autoload/dist/vim9.vim
index 807140da7c..8fa9380f57 100644
--- a/runtime/autoload/dist/vim9.vim
+++ b/runtime/autoload/dist/vim9.vim
@@ -6,6 +6,10 @@ vim9script
# Last Change: 2023 Oct 25
export def IsSafeExecutable(filetype: string, executable: string): bool
+ if empty(exepath(executable))
+ echomsg executable .. " not found in $PATH"
+ return v:false
+ endif
var cwd = getcwd()
return get(g:, filetype .. '_exec', get(g:, 'plugin_exec', 0))
&& (fnamemodify(exepath(executable), ':p:h') !=# cwd