diff options
author | Christian Clason <c.clason@uni-graz.at> | 2024-05-10 18:30:15 +0200 |
---|---|---|
committer | Christian Clason <c.clason@uni-graz.at> | 2024-05-11 09:13:57 +0200 |
commit | a9fd17e23289c4a74edbb6f02abde14ab4eac05c (patch) | |
tree | c7f481d20a9ffac95438397801a40c9a22311713 /runtime/lua/vim | |
parent | 8c7a8be27437d8f2d640daf1c2598d4c18933e04 (diff) | |
download | rneovim-a9fd17e23289c4a74edbb6f02abde14ab4eac05c.tar.gz rneovim-a9fd17e23289c4a74edbb6f02abde14ab4eac05c.tar.bz2 rneovim-a9fd17e23289c4a74edbb6f02abde14ab4eac05c.zip |
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
https://github.com/vim/vim/commit/887a38cee78c472fe406da60751fbba4a6ec19dd
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/filetype.lua | 3 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 14 |
2 files changed, 11 insertions, 6 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 1ea1bbccf6..4d3d219415 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -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, diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 05b4ffc223..ba86d8de5a 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -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; |