Firenvim website blacklisting
This commit is contained in:
parent
e5aa15485c
commit
2b8c7a00a9
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue