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