aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorJason Lenz <code@engenforge.com>2025-12-30 12:18:25 -0600
committerRandy Palamar <randy@rnpnr.xyz>2025-12-30 15:55:34 -0700
commit3eb76812068a0db261e5fd9e7713107665ddaf54 (patch)
treeda5c428a82ab63af648bf311458bf13cd24fcd25 /lua/plugins
parentb9c3df05c5d8874cb7b726217c4ea6e3c7ded26a (diff)
downloadvis-3eb76812068a0db261e5fd9e7713107665ddaf54.tar.gz
vis-3eb76812068a0db261e5fd9e7713107665ddaf54.tar.xz
lua: filetype: fix collision for lexers that target text files
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/filetype.lua13
1 files changed, 3 insertions, 10 deletions
diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua
index 7cdb1a8..be34a8a 100644
--- a/lua/plugins/filetype.lua
+++ b/lua/plugins/filetype.lua
@@ -461,9 +461,7 @@ vis.ftdetect.filetypes = {
ext = { "%.texi$" },
},
text = {
- ext = { "%.txt$" },
- -- Do *not* list mime "text/plain" here, it is covered below,
- -- see 'try text lexer as a last resort'
+ -- Do *not* match on this, it is used as a default
},
todotxt = {
ext = { "^todo.txt$", "^Todo.txt$", "^done.txt$", "^Done.txt$" },
@@ -643,12 +641,7 @@ 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)
+ -- default to text lexer if nothing else is found
+ set_filetype('text', vis.ftdetect.filetypes.text)
end)