1
Fork 0

Firenvim website blacklisting

This commit is contained in:
Matei Adriel 2023-03-17 00:54:34 +01:00
parent e5aa15485c
commit 2b8c7a00a9
No known key found for this signature in database

View file

@ -4,23 +4,25 @@ local K = require("my.keymaps")
local M = {
"glacambre/firenvim", -- vim inside chrome
lazy = false,
-- cond = env.firenvim.active(),
cond = true
cond = env.firenvim.active(),
}
function M.blacklist(url)
vim.g.firenvim_config.localSettings[url] = { takeover = "never" }
M.localSettings = {}
local function make_url_regex(url)
return "https?:\\/\\/(?:www\\.)?" .. url .. ".*"
end
local function blacklist(url)
M.localSettings[make_url_regex(url)] = { takeover = "never", priority = 0 }
end
function M.config()
vim.g.firenvim_config = {
localSettings = {
[".*"] = {
filename = "/tmp/firenvim_{hostname}_{pathname}_{selector}_{timestamp}.{extension}",
},
},
-- {{{ Filename
M.localSettings[".*"] = {
filename = "/tmp/firenvim_{hostname}_{pathname}_{selector}_{timestamp}.{extension}",
}
-- }}}
-- {{{ Ctrl-z to expand window
K.nmap("<C-z>", function()
vim.opt.lines = 25
@ -39,15 +41,18 @@ function M.config()
vim.opt.laststatus = 0
-- }}}
-- {{{ Blacklist websites
local blacklisted = {
"https?://web.whatsapp\\.com/.*",
"https?://twitter\\.com/",
}
for _, url in ipairs(blacklisted) do
M.blacklist(url)
end
blacklist("web\\.whatsapp\\.com")
blacklist("twitter\\.com")
blacklist("desmos\\.com\\/calculator")
-- }}}
-- {{{ Comitting our config changes
vim.g.firenvim_config = { localSettings = M.localSettings }
-- }}}
end
function M.setup()
M.config()
print(vim.inspect(M.localSettings))
end
return M