Compare commits
2 Commits
86ee347e45
...
02ffe71292
Author | SHA1 | Date | |
---|---|---|---|
02ffe71292 | |||
e86b68b7a6 |
@ -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 BufNew to open files in custom programs" })
|
end, { desc = "Toggles intercepting BufEnter 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({ "BufNew" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
---@type string
|
---@type string
|
||||||
@ -102,17 +102,12 @@ M.setup = function()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local extension_callbacks = {
|
local extension_callbacks = {
|
||||||
["pdf"] = function(buf, fpath, fname)
|
["pdf"] = open_mime,
|
||||||
open_mime(buf, fpath, fname)
|
|
||||||
end,
|
|
||||||
["djvu"] = "pdf",
|
["djvu"] = "pdf",
|
||||||
["png"] = function(buf, fpath, fname)
|
["wav"] = open_mime,
|
||||||
open_mime(buf, fpath, fname)
|
["png"] = open_mime,
|
||||||
end,
|
|
||||||
["jpg"] = "png",
|
["jpg"] = "png",
|
||||||
["mp4"] = function(buf, fpath, fname)
|
["mp4"] = open_mime,
|
||||||
open_mime(buf, fpath, fname)
|
|
||||||
end,
|
|
||||||
["gif"] = "mp4",
|
["gif"] = "mp4",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user