aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsugabubus <zsugabubus@users.noreply.github.com>2020-01-12 12:27:39 +0100
committerzsugabubus <zsugabubus@users.noreply.github.com>2020-01-12 12:34:48 +0100
commitfebe0528303f838fa9f346aa343fff0fe29f5ba3 (patch)
tree0cbe679f268d27a24df595a308c548db13949d6a
parent807ba6f6850bf7dbf86fd65299248f2d9cba7f75 (diff)
downloadvis-febe0528303f838fa9f346aa343fff0fe29f5ba3.tar.gz
vis-febe0528303f838fa9f346aa343fff0fe29f5ba3.tar.xz
filetype: try text lexer as a last resort
-rw-r--r--lua/plugins/filetype.lua10
1 files changed, 10 insertions, 0 deletions
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)