mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
vim-patch:9.1.0401: filetype: zsh module files are not recognized
Problem: filetype: zsh module files are not recognized
Solution: Detect '*.mdh' and '*.epro' as C filetype, '*.mdd' as zsh
filetype, determine zsh-modules '*.pro' from from it's content
(Wu, Zhenyu)
closes: vim/vim#14737
887a38cee7
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
This commit is contained in:
@@ -248,6 +248,8 @@ local extension = {
|
||||
bzl = 'bzl',
|
||||
bazel = 'bzl',
|
||||
BUILD = 'bzl',
|
||||
mdh = 'c',
|
||||
epro = 'c',
|
||||
qc = 'c',
|
||||
cabal = 'cabal',
|
||||
cairo = 'cairo',
|
||||
@@ -1206,6 +1208,7 @@ local extension = {
|
||||
zsh = 'zsh',
|
||||
zunit = 'zsh',
|
||||
['zsh-theme'] = 'zsh',
|
||||
mdd = 'zsh',
|
||||
vala = 'vala',
|
||||
web = detect.web,
|
||||
pl = detect.pl,
|
||||
|
||||
@@ -1141,12 +1141,14 @@ end
|
||||
--- Distinguish between "default", Prolog and Cproto prototype file.
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.proto(_, bufnr)
|
||||
-- Cproto files have a comment in the first line and a function prototype in
|
||||
-- the second line, it always ends in ";". Indent files may also have
|
||||
-- comments, thus we can't match comments to see the difference.
|
||||
-- IDL files can have a single ';' in the second line, require at least one
|
||||
-- character before the ';'.
|
||||
if getline(bufnr, 2):find('.;$') then
|
||||
if getline(bufnr, 2):find('/%* Generated automatically %*/') then
|
||||
return 'c'
|
||||
elseif getline(bufnr, 2):find('.;$') then
|
||||
-- Cproto files have a comment in the first line and a function prototype in
|
||||
-- the second line, it always ends in ";". Indent files may also have
|
||||
-- comments, thus we can't match comments to see the difference.
|
||||
-- IDL files can have a single ';' in the second line, require at least one
|
||||
-- character before the ';'.
|
||||
return 'cpp'
|
||||
end
|
||||
-- Recognize Prolog by specific text in the first non-empty line;
|
||||
|
||||
Reference in New Issue
Block a user