aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/autoload/dist/ft.vim17
-rw-r--r--runtime/doc/api.txt25
-rw-r--r--runtime/filetype.vim12
-rw-r--r--runtime/lua/vim/filetype.lua4
4 files changed, 51 insertions, 7 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index c52def1051..959f4be896 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -899,6 +899,23 @@ func dist#ft#FTtf()
setf tf
endfunc
+" Determine if a *.src file is Kuka Robot Language
+func dist#ft#FTsrc()
+ if exists("g:filetype_src")
+ exe "setf " .. g:filetype_src
+ elseif getline(nextnonblank(1)) =~? '^\s*\%(&\w\+\|\%(global\s\+\)\?def\>\)'
+ setf krl
+ endif
+endfunc
+
+" Determine if a *.dat file is Kuka Robot Language
+func dist#ft#FTdat()
+ if exists("g:filetype_dat")
+ exe "setf " .. g:filetype_dat
+ elseif getline(nextnonblank(1)) =~? '^\s*\%(&\w\+\|defdat\>\)'
+ setf krl
+ endif
+endfunc
" Restore 'cpoptions'
let &cpo = s:cpo_save
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index b383c5eaef..095f74b65d 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -3240,7 +3240,7 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
<
Parameters: ~
- {event} (String|Array) The event or events to register
+ {event} (string|array) The event or events to register
this autocommand
{opts} Dictionary of autocommand options:
• group (string|integer) optional: the
@@ -3252,9 +3252,26 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
Cannot be used with {pattern}.
• desc (string) optional: description of the
autocommand.
- • callback (function|string) optional: Lua
- function or Vim function (as string) to execute
- on event. Cannot be used with {command}
+ • callback (function|string) optional: if a
+ string, the name of a Vimscript function to
+ call when this autocommand is triggered.
+ Otherwise, a Lua function which is called when
+ this autocommand is triggered. Cannot be used
+ with {command}. Lua callbacks can return true
+ to delete the autocommand; in addition, they
+ accept a single table argument with the
+ following keys:
+ • id: (number) the autocommand id
+ • event: (string) the name of the event that
+ triggered the autocommand |autocmd-events|
+ • group: (number|nil) the autocommand group id,
+ if it exists
+ • match: (string) the expanded value of
+ |<amatch>|
+ • buf: (number) the expanded value of |<abuf>|
+ • file: (string) the expanded value of
+ |<afile>|
+
• command (string) optional: Vim command to
execute on event. Cannot be used with
{callback}
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 2f4b03606c..bc94ea848c 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -947,6 +947,11 @@ au BufNewFile,BufRead *.jl setf julia
" Kixtart
au BufNewFile,BufRead *.kix setf kix
+" Kuka Robot Language
+au BufNewFile,BufRead *.src\c call dist#ft#FTsrc()
+au BufNewFile,BufRead *.dat\c call dist#ft#FTdat()
+au BufNewFile,BufRead *.sub\c setf krl
+
" Kimwitu[++]
au BufNewFile,BufRead *.k setf kwt
@@ -1343,9 +1348,10 @@ au BufNewFile,BufRead *.pm
au BufNewFile,BufRead *.pod setf pod
" Php, php3, php4, etc.
-" Also Phtml (was used for PHP 2 in the past)
-" Also .ctp for Cake template file
-au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp setf php
+" Also Phtml (was used for PHP 2 in the past).
+" Also .ctp for Cake template file.
+" Also .phpt for php tests.
+au BufNewFile,BufRead *.php,*.php\d,*.phtml,*.ctp,*.phpt setf php
" PHP config
au BufNewFile,BufRead php.ini-* setf dosini
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 65edaed530..6d8f734bed 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -457,6 +457,7 @@ local extension = {
al = "perl",
ctp = "php",
php = "php",
+ phpt = "php",
phtml = "php",
pike = "pike",
pmod = "pike",
@@ -1427,6 +1428,9 @@ local pattern = {
return "git"
end
end,
+ [".*%.[Dd][Aa][Tt]"] = function() vim.fn["dist#ft#FTdat"]() end,
+ [".*%.[Ss][Rr][Cc]"] = function() vim.fn["dist#ft#FTsrc"]() end,
+ [".*%.[Ss][Uu][Bb]"] = "krl",
-- Neovim only
[".*/queries/.*%.scm"] = "query", -- tree-sitter queries
-- END PATTERN