mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 10:28:33 +00:00
vim-patch:9.1.0982: TI linker files are not recognized
Problem: TI linker files are not recognized
Solution: inspect '*.cmd' files and detect TI linker files
as 'lnk' filetype, include a lnk ftplugin and syntax
script (Wu, Zhenyu)
closes: vim/vim#16320
39a4eb0b2c
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
This commit is contained in:
committed by
Christian Clason
parent
7ecd348b3d
commit
1877cd5fcd
@@ -1393,7 +1393,7 @@ local extension = {
|
||||
txt = detect.txt,
|
||||
xml = detect.xml,
|
||||
y = detect.y,
|
||||
cmd = detect_line1('^/%*', 'rexx', 'dosbatch'),
|
||||
cmd = detect.cmd,
|
||||
rul = detect.rul,
|
||||
cpy = detect_line1('^##', 'python', 'cobol'),
|
||||
dsl = detect_line1('^%s*<!', 'dsl', 'structurizr'),
|
||||
|
||||
@@ -219,6 +219,24 @@ function M.cls(_, bufnr)
|
||||
return 'st'
|
||||
end
|
||||
|
||||
--- *.cmd is close to a Batch file, but on OS/2 Rexx files and TI linker command files also use *.cmd.
|
||||
--- lnk: `/* comment */`, `// comment`, and `--linker-option=value`
|
||||
--- rexx: `/* comment */`, `-- comment`
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.cmd(_, bufnr)
|
||||
local lines = table.concat(getlines(bufnr, 1, 20))
|
||||
if matchregex(lines, [[MEMORY\|SECTIONS\|\%(^\|\n\)--\S\|\%(^\|\n\)//]]) then
|
||||
return 'lnk'
|
||||
else
|
||||
local line1 = getline(bufnr, 1)
|
||||
if line1:find('^/%*') then
|
||||
return 'rexx'
|
||||
else
|
||||
return 'dosbatch'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.conf(path, bufnr)
|
||||
if fn.did_filetype() ~= 0 or path:find(vim.g.ft_ignore_pat) then
|
||||
|
||||
Reference in New Issue
Block a user