aboutsummaryrefslogtreecommitdiff
path: root/lua/plugins/filetype.lua
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2020-12-26 23:18:43 +0100
committerMarc André Tanner <mat@brain-dump.org>2020-12-27 11:29:50 +0100
commit41b235584feeb492d082cdc7bbb735cc49b08180 (patch)
treee965e35b2f00240611794707e9e75c18f4f89474 /lua/plugins/filetype.lua
parent40c387aca214f701cd316c63b290ba7f35abbe3a (diff)
downloadvis-41b235584feeb492d082cdc7bbb735cc49b08180.tar.gz
vis-41b235584feeb492d082cdc7bbb735cc49b08180.tar.xz
lua: fix luacheck warnings
These are either accidentally global or unused variables. In the file type pluging the mime type variable was wrongly scoped, meaning the text/plain settings applied to all otherwise unknown files.
Diffstat (limited to 'lua/plugins/filetype.lua')
-rw-r--r--lua/plugins/filetype.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/lua/plugins/filetype.lua b/lua/plugins/filetype.lua
index 4639bbc..e5e45fd 100644
--- a/lua/plugins/filetype.lua
+++ b/lua/plugins/filetype.lua
@@ -352,7 +352,7 @@ vis.ftdetect.filetypes = {
},
routeros = {
ext = { "%.rsc" },
- detect = function(file, data)
+ detect = function(_, data)
return data:match("^#.* by RouterOS")
end
},
@@ -394,7 +394,7 @@ vis.ftdetect.filetypes = {
ext = { "%.ddl$", "%.sql$" },
},
strace = {
- detect = function(file, data)
+ detect = function(_, data)
return data:match("^execve%(")
end
},
@@ -501,10 +501,11 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
end
-- run file(1) to determine mime type
+ local mime
if name ~= nil then
local file = io.popen(string.format("file -bL --mime-type -- '%s'", name:gsub("'", "'\\''")))
if file then
- local mime = file:read('*all')
+ mime = file:read('*all')
file:close()
if mime then
mime = mime:gsub('%s*$', '')