Skip to content

Commit

Permalink
refactor(runtime): convert dist#ft functions to lua (neovim#18247)
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Clason <christian.clason@uni-due.de>
  • Loading branch information
2 people authored and kylo252 committed May 5, 2022
1 parent 0953eee commit d7a9ac9
Show file tree
Hide file tree
Showing 2 changed files with 455 additions and 42 deletions.
84 changes: 42 additions & 42 deletions runtime/lua/vim/filetype.lua
Original file line number Diff line number Diff line change
Expand Up @@ -784,19 +784,19 @@ local extension = {
zsh = "zsh",
vala = "vala",
E = function() vim.fn["dist#ft#FTe"]() end,
EU = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
EW = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
EX = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
EXU = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
EXW = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
EU = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
EW = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
EX = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
EXU = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
EXW = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
PL = function() vim.fn["dist#ft#FTpl"]() end,
R = function() vim.fn["dist#ft#FTr"]() end,
R = function(path, bufnr) require("vim.filetype.detect").r(bufnr) end,
asm = function() vim.fn["dist#ft#FTasm"]() end,
bas = function() vim.fn["dist#ft#FTbas"]() end,
bi = function() vim.fn["dist#ft#FTbas"]() end,
bm = function() vim.fn["dist#ft#FTbas"]() end,
bash = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
btm = function() vim.fn["dist#ft#FTbtm"]() end,
btm = function(path, bufnr) return require("vim.filetype.detect").btm(bufnr) end,
c = function() vim.fn["dist#ft#FTlpc"]() end,
ch = function() vim.fn["dist#ft#FTchange"]() end,
com = function() vim.fn["dist#ft#BindzoneCheck"]('dcl') end,
Expand All @@ -808,29 +808,29 @@ local extension = {
e = function() vim.fn["dist#ft#FTe"]() end,
ebuild = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
eclass = function() vim.fn["dist#ft#SetFileTypeSH"]("bash") end,
ent = function() vim.fn["dist#ft#FTent"]() end,
ent = function(path, bufnr) return require("vim.filetype.detect").ent(bufnr) end,
env = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
eu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
ew = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
ex = function() vim.fn["dist#ft#ExCheck"]() end,
exu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
exw = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
frm = function() vim.fn["dist#ft#FTfrm"]() end,
eu = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
ew = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
ex = function(path, bufnr) return require("vim.filetype.detect").ex(bufnr) end,
exu = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
exw = function(path, bufnr) return require("vim.filetype.detect").euphoria(bufnr) end,
frm = function(path, bufnr) require("vim.filetype.detect").frm(bufnr) end,
fs = function() vim.fn["dist#ft#FTfs"]() end,
h = function() vim.fn["dist#ft#FTheader"]() end,
h = function(path, bufnr) require("vim.filetype.detect").header(bufnr) end,
htm = function() vim.fn["dist#ft#FThtml"]() end,
html = function() vim.fn["dist#ft#FThtml"]() end,
i = function() vim.fn["dist#ft#FTprogress_asm"]() end,
idl = function() vim.fn["dist#ft#FTidl"]() end,
idl = function(path, bufnr) require("vim.filetype.detect").idl(bufnr) end,
inc = function() vim.fn["dist#ft#FTinc"]() end,
inp = function() vim.fn["dist#ft#Check_inp"]() end,
inp = function(path, bufnr) require("vim.filetype.detect").inp(bufnr) end,
ksh = function() vim.fn["dist#ft#SetFileTypeSH"]("ksh") end,
lst = function() vim.fn["dist#ft#FTasm"]() end,
m = function() vim.fn["dist#ft#FTm"]() end,
mac = function() vim.fn["dist#ft#FTasm"]() end,
mc = function() vim.fn["dist#ft#McSetf"]() end,
mc = function(path, bufnr) require("vim.filetype.detect").mc(bufnr) end,
mm = function() vim.fn["dist#ft#FTmm"]() end,
mms = function() vim.fn["dist#ft#FTmms"]() end,
mms = function(path, bufnr) require("vim.filetype.detect").mms(bufnr) end,
p = function() vim.fn["dist#ft#FTprogress_pascal"]() end,
patch = function(path, bufnr)
local firstline = getline(bufnr, 1)
Expand All @@ -844,22 +844,22 @@ local extension = {
pp = function() vim.fn["dist#ft#FTpp"]() end,
pro = function() vim.fn["dist#ft#ProtoCheck"]('idlang') end,
pt = function() vim.fn["dist#ft#FThtml"]() end,
r = function() vim.fn["dist#ft#FTr"]() end,
rdf = function() vim.fn["dist#ft#Redif"]() end,
r = function(path, bufnr) require("vim.filetype.detect").r(bufnr) end,
rdf = function(path, bufnr) require("vim.filetype.detect").redif(bufnr) end,
rules = function() vim.fn["dist#ft#FTRules"]() end,
sc = function() vim.fn["dist#ft#FTsc"]() end,
scd = function() vim.fn["dist#ft#FTscd"]() end,
sc = function(path, bufnr) require("vim.filetype.detect").sc(bufnr) end,
scd = function(path, bufnr) require("vim.filetype.detect").scd(bufnr) end,
sh = function() vim.fn["dist#ft#SetFileTypeSH"](vim.fn.getline(1)) end,
shtml = function() vim.fn["dist#ft#FThtml"]() end,
sql = function() vim.fn["dist#ft#SQL"]() end,
sql = function(path, bufnr) require("vim.filetype.detect").sql(bufnr) end,
stm = function() vim.fn["dist#ft#FThtml"]() end,
tcsh = function() vim.fn["dist#ft#SetFileTypeShell"]("tcsh") end,
tex = function() vim.fn["dist#ft#FTtex"]() end,
tf = function() vim.fn["dist#ft#FTtf"]() end,
w = function() vim.fn["dist#ft#FTprogress_cweb"]() end,
xml = function() vim.fn["dist#ft#FTxml"]() end,
y = function() vim.fn["dist#ft#FTy"]() end,
zsql = function() vim.fn["dist#ft#SQL"]() end,
tf = function(path, bufnr) require("vim.filetype.detect").tf(bufnr) end,
w = function(path, bufnr) require("vim.filetype.detect").progress_cweb(bufnr) end,
xml = function(path, bufnr) require("vim.filetype.detect").xml(bufnr) end,
y = function(path, bufnr) require("vim.filetype.detect").y(bufnr) end,
zsql = function(path, bufnr) require("vim.filetype.detect").sql(bufnr) end,
txt = function(path, bufnr)
--helpfiles match *.txt, but should have a modeline as last line
if not getline(bufnr, -1):match("vim:.*ft=help") then
Expand Down Expand Up @@ -933,10 +933,10 @@ local filename = {
["exim.conf"] = "exim",
exports = "exports",
[".fetchmailrc"] = "fetchmail",
fvSchemes = function() vim.fn["dist#ft#FTfoam"]() end,
fvSolution = function() vim.fn["dist#ft#FTfoam"]() end,
fvConstraints = function() vim.fn["dist#ft#FTfoam"]() end,
fvModels = function() vim.fn["dist#ft#FTfoam"]() end,
fvSchemes = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
fvSolution = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
fvConstraints = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
fvModels = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
fstab = "fstab",
mtab = "fstab",
[".gdbinit"] = "gdb",
Expand Down Expand Up @@ -1355,7 +1355,7 @@ local pattern = {
["%.zcompdump.*"] = starsetf('zsh'),
["%.zlog.*"] = starsetf('zsh'),
["%.zsh.*"] = starsetf('zsh'),
[".*%.[1-9]"] = function() vim.fn["dist#ft#FTnroff"]() end,
[".*%.[1-9]"] = function(path, bufnr) return require("vim.filetype.detect").nroff(bufnr) end,
[".*%.[aA]"] = function() vim.fn["dist#ft#FTasm"]() end,
[".*%.[sS]"] = function() vim.fn["dist#ft#FTasm"]() end,
[".*%.properties_.._.._.*"] = starsetf('jproperties'),
Expand Down Expand Up @@ -1434,14 +1434,14 @@ local pattern = {
["mutt" .. string.rep("[%w_-]", 6)] = "mail",
["neomutt" .. string.rep("[%w_-]", 6)] = "mail",
["/tmp/SLRN[0-9A-Z.]+"] = "mail",
["[a-zA-Z0-9].*Dict"] = function() vim.fn["dist#ft#FTfoam"]() end,
["[a-zA-Z0-9].*Dict%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
["[a-zA-Z].*Properties"] = function() vim.fn["dist#ft#FTfoam"]() end,
["[a-zA-Z].*Properties%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
[".*Transport%..*"] = function() vim.fn["dist#ft#FTfoam"]() end,
[".*/constant/g"] = function() vim.fn["dist#ft#FTfoam"]() end,
[".*/0/.*"] = function() vim.fn["dist#ft#FTfoam"]() end,
[".*/0%.orig/.*"] = function() vim.fn["dist#ft#FTfoam"]() end,
["[a-zA-Z0-9].*Dict"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
["[a-zA-Z0-9].*Dict%..*"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
["[a-zA-Z].*Properties"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
["[a-zA-Z].*Properties%..*"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
[".*Transport%..*"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
[".*/constant/g"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
[".*/0/.*"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
[".*/0%.orig/.*"] = function(path, bufnr) require("vim.filetype.detect").foam(bufnr) end,
[".*/etc/sensors%.d/[^.].*"] = starsetf('sensors'),
[".*%.git/.*"] = function(path, bufnr)
local firstline = getline(bufnr, 1)
Expand Down
Loading

0 comments on commit d7a9ac9

Please sign in to comment.