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

61ee833a50

Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
This commit is contained in:
zeertzjq
2024-04-12 17:02:25 +08:00
committed by GitHub
parent fe42574230
commit 5aee587970
3 changed files with 31 additions and 4 deletions

View File

@@ -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 } },

View File

@@ -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

View File

@@ -736,7 +736,7 @@ func s:GetFilenameChecks() abort
\ 'teraterm': ['file.ttl'],
\ 'terminfo': ['file.ti'],
\ 'terraform-vars': ['file.tfvars'],
\ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'],
\ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl', 'any/.texlive/texmf-config/tex/latex/file/file.cfg', 'file.pgf', 'file.nlo', 'file.nls', 'file.out', 'file.thm', 'file.eps_tex', 'file.pygtex', 'file.pygstyle', 'file.clo', 'file.aux', 'file.brf', 'file.ind', 'file.lof', 'file.loe', 'file.nav', 'file.vrb', 'file.ins', 'file.tikz', 'file.bbx', 'file.cbx', 'file.beamer'],
\ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'],
\ 'texmf': ['texmf.cnf'],
\ 'text': ['file.text', 'file.txt', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README', '/etc/Muttrc.d/README'],