vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 5e07a5835a4a37997accb5b0f08d3c227466b084
parent a7234a3e5e6f18ed5e4fa455e9a6a0905d818a49
Author: zsugabubus <zsugabubus@users.noreply.github.com>
Date:   Sun, 12 Jan 2020 12:27:39 +0100

filetype: try text lexer as a last resort

Diffstat:
Mlua/plugins/filetype.lua | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git 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)