@@ -192,8 +192,8 @@ previewers.file_maker = function(filepath, bufnr, opts)
|
|||||||
if opts.preview.check_mime_type == true and has_file and opts.ft == "" then
|
if opts.preview.check_mime_type == true and has_file and opts.ft == "" then
|
||||||
-- avoid SIGABRT in buffer previewer happening with utils.get_os_command_output
|
-- avoid SIGABRT in buffer previewer happening with utils.get_os_command_output
|
||||||
local output = capture(string.format([[file --mime-type -b "%s"]], filepath))
|
local output = capture(string.format([[file --mime-type -b "%s"]], filepath))
|
||||||
local mime_type = vim.split(output, "/")[1]
|
local mime_type = vim.split(output, "/")
|
||||||
if mime_type ~= "text" and mime_type ~= "inode" then
|
if mime_type[1] ~= "text" and mime_type[1] ~= "inode" and mime_type[2] ~= "json" then
|
||||||
if type(opts.preview.mime_hook) == "function" then
|
if type(opts.preview.mime_hook) == "function" then
|
||||||
vim.schedule_wrap(opts.preview.mime_hook)(filepath, bufnr, opts)
|
vim.schedule_wrap(opts.preview.mime_hook)(filepath, bufnr, opts)
|
||||||
else
|
else
|
||||||
@@ -206,6 +206,9 @@ previewers.file_maker = function(filepath, bufnr, opts)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if mime_type[2] == "json" then
|
||||||
|
opts.ft = "json"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.preview.filesize_limit then
|
if opts.preview.filesize_limit then
|
||||||
|
|||||||
Reference in New Issue
Block a user