From 3b798d3002e0b35a5f8890d29035fc91642fd6e0 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 26 Jun 2019 12:34:35 -0700 Subject: filetype: Match known filenames exactly Otherwise, a file like `passwd.c` will match both ansi_c and dsv. The one that gets chosen depends on the iteration order of table, which is non-deterministic. --- lua/plugins/filetype.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 6c574bc..35912f6 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -102,13 +102,13 @@ vis.ftdetect.filetypes = { ext = { "%.d$", "%.di$" }, }, dockerfile = { - ext = { "Dockerfile" }, + ext = { "^Dockerfile$", "%.Dockerfile$" }, }, dot = { ext = { "%.dot$" }, }, dsv = { - ext = { "group", "gshadow", "passwd", "shadow" }, + ext = { "^group$", "^gshadow$", "^passwd$", "^shadow$" }, }, eiffel = { ext = { "%.e$", "%.eif$" }, @@ -282,7 +282,7 @@ vis.ftdetect.filetypes = { ext = { "%.pike$", "%.pmod$" }, }, pkgbuild = { - ext = { "PKGBUILD" }, + ext = { "^PKGBUILD$" }, }, pony = { ext = { "%.pony$" }, -- cgit v1.2.3 From febe0528303f838fa9f346aa343fff0fe29f5ba3 Mon Sep 17 00:00:00 2001 From: zsugabubus Date: Sun, 12 Jan 2020 12:27:39 +0100 Subject: filetype: try text lexer as a last resort --- lua/plugins/filetype.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lua/plugins') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 35912f6..c7fad69 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -385,6 +385,10 @@ vis.ftdetect.filetypes = { texinfo = { ext = { "%.texi$" }, }, + text = { + ext = { "%.txt$" }, + mime = { "text/plain" }, + }, toml = { ext = { "%.toml$" }, }, @@ -497,6 +501,12 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) end end + -- try text lexer as a last resort + if (mime or 'text/plain'):match('^text/.+$') then + set_filetype('text', vis.ftdetect.filetypes.text) + return + end + win:set_syntax(nil) end) -- cgit v1.2.3 From aa526ad03807cf964671ae9d36c4311f0219e567 Mon Sep 17 00:00:00 2001 From: Georgi Kirilov Date: Tue, 15 Oct 2019 00:09:16 +0300 Subject: lexers: add Fennel support --- lua/plugins/filetype.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lua/plugins') diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua index 35912f6..601bfa2 100644 --- a/lua/plugins/filetype.lua +++ b/lua/plugins/filetype.lua @@ -125,6 +125,9 @@ vis.ftdetect.filetypes = { faust = { ext = { "%.dsp$" }, }, + fennel = { + ext = { "%.fnl$" }, + }, fish = { ext = { "%.fish$" }, }, -- cgit v1.2.3