Compare commits
No commits in common. "02ffe7129208090fa0186274dd2e7935cb2936a5" and "86ee347e45a51f09471aca75bcc0476c2d046727" have entirely different histories.
02ffe71292
...
86ee347e45
@ -72,11 +72,11 @@ M.setup = function()
|
|||||||
vim.notify("Intercept file open set to " .. intercept_state, vim.log.levels.INFO, {
|
vim.notify("Intercept file open set to " .. intercept_state, vim.log.levels.INFO, {
|
||||||
title = "Intercept File Open",
|
title = "Intercept File Open",
|
||||||
})
|
})
|
||||||
end, { desc = "Toggles intercepting BufEnter to open files in custom programs" })
|
end, { desc = "Toggles intercepting BufNew to open files in custom programs" })
|
||||||
|
|
||||||
-- NOTE: Add "BufReadPre" to the autocmd events to also intercept files given on the command line, e.g.
|
-- NOTE: Add "BufReadPre" to the autocmd events to also intercept files given on the command line, e.g.
|
||||||
-- `nvim myfile.txt`
|
-- `nvim myfile.txt`
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
vim.api.nvim_create_autocmd({ "BufNew" }, {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
---@type string
|
---@type string
|
||||||
@ -102,12 +102,17 @@ M.setup = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local extension_callbacks = {
|
local extension_callbacks = {
|
||||||
["pdf"] = open_mime,
|
["pdf"] = function(buf, fpath, fname)
|
||||||
|
open_mime(buf, fpath, fname)
|
||||||
|
end,
|
||||||
["djvu"] = "pdf",
|
["djvu"] = "pdf",
|
||||||
["wav"] = open_mime,
|
["png"] = function(buf, fpath, fname)
|
||||||
["png"] = open_mime,
|
open_mime(buf, fpath, fname)
|
||||||
|
end,
|
||||||
["jpg"] = "png",
|
["jpg"] = "png",
|
||||||
["mp4"] = open_mime,
|
["mp4"] = function(buf, fpath, fname)
|
||||||
|
open_mime(buf, fpath, fname)
|
||||||
|
end,
|
||||||
["gif"] = "mp4",
|
["gif"] = "mp4",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user