diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-04-12 17:02:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-12 17:02:25 +0800 |
commit | 5aee5879703eeaf65896059b70b41988d3af6dca (patch) | |
tree | eeb9c1abdedfb32e5dfdf977e8761f4c006ff076 /runtime | |
parent | fe42574230ab399b5de22cc2b92368a0bfe4e21a (diff) | |
download | rneovim-5aee5879703eeaf65896059b70b41988d3af6dca.tar.gz rneovim-5aee5879703eeaf65896059b70b41988d3af6dca.tar.bz2 rneovim-5aee5879703eeaf65896059b70b41988d3af6dca.zip |
vim-patch:9.1.0289: filetype: some TeX files are not recognized (#28291)
Problem: filetype: some TeX files are not recognized
Solution: Add more patterns for TeX files and inspect
a few more files for being TeX files
(Wu, Zhenyu)
closes: vim/vim#14456
https://github.com/vim/vim/commit/61ee833a504ae73bc6b3e2527a81582263f02afd
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/lua/vim/filetype.lua | 26 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 7 |
2 files changed, 30 insertions, 3 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index bbe1e2c89c..06761fefe9 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -252,7 +252,7 @@ local extension = { capnp = 'capnp', cdc = 'cdc', cdl = 'cdl', - toc = 'cdrtoc', + toc = detect_line1('\\contentsline', 'tex', 'cdrtoc'), cfc = 'cf', cfm = 'cf', cfi = 'cf', @@ -631,7 +631,7 @@ local extension = { livemd = 'livebook', lgt = 'logtalk', lotos = 'lotos', - lot = 'lotos', + lot = detect_line1('\\contentsline', 'tex', 'lotos'), lout = 'lout', lou = 'lout', ulpc = 'lpc', @@ -1035,6 +1035,27 @@ local extension = { bbl = 'tex', latex = 'tex', sty = 'tex', + pgf = 'tex', + nlo = 'tex', + nls = 'tex', + out = 'tex', + thm = 'tex', + eps_tex = 'tex', + pygtex = 'tex', + pygstyle = 'tex', + clo = 'tex', + aux = 'tex', + brf = 'tex', + ind = 'tex', + lof = 'tex', + loe = 'tex', + nav = 'tex', + vrb = 'tex', + ins = 'tex', + tikz = 'tex', + bbx = 'tex', + cbx = 'tex', + beamer = 'tex', cls = detect.cls, texi = 'texinfo', txi = 'texinfo', @@ -2023,6 +2044,7 @@ local pattern = { ['.*termcap.*'] = starsetf(function(path, bufnr) return require('vim.filetype.detect').printcap('term') end), + ['.*/tex/latex/.*%.cfg'] = 'tex', ['.*%.t%.html'] = 'tilde', ['%.?tmux.*%.conf'] = 'tmux', ['%.?tmux.*%.conf.*'] = { 'tmux', { priority = -1 } }, diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index ca2c53b75d..c48984d151 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -458,6 +458,9 @@ end --- @type vim.filetype.mapfn function M.def(_, bufnr) + if getline(bufnr, 1):find('%%%%') then + return 'tex' + end if vim.g.filetype_def == 'modula2' or is_modula2(bufnr) then return modula2(bufnr) end @@ -738,7 +741,9 @@ end --- @type vim.filetype.mapfn function M.inp(_, bufnr) - if getline(bufnr, 1):find('^%*') then + if getline(bufnr, 1):find('%%%%') then + return 'tex' + elseif getline(bufnr, 1):find('^%*') then return 'abaqus' else for _, line in ipairs(getlines(bufnr, 1, 500)) do |