2023-01-10 02:38:06 +01:00
|
|
|
local env = require("my.helpers.env")
|
2023-02-24 14:35:01 +01:00
|
|
|
local K = require("my.keymaps")
|
2023-01-10 02:38:06 +01:00
|
|
|
|
|
|
|
local M = {
|
|
|
|
"glacambre/firenvim", -- vim inside chrome
|
|
|
|
lazy = false,
|
2023-03-17 00:54:34 +01:00
|
|
|
cond = env.firenvim.active(),
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|
|
|
|
|
2023-03-17 00:54:34 +01:00
|
|
|
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 }
|
2023-03-16 22:22:06 +01:00
|
|
|
end
|
|
|
|
|
2023-02-09 06:59:58 +01:00
|
|
|
function M.config()
|
2023-03-17 00:54:34 +01:00
|
|
|
-- {{{ Filename
|
|
|
|
M.localSettings[".*"] = {
|
|
|
|
filename = "/tmp/firenvim_{hostname}_{pathname}_{selector}_{timestamp}.{extension}",
|
2023-01-10 02:38:06 +01:00
|
|
|
}
|
2023-03-17 00:54:34 +01:00
|
|
|
-- }}}
|
2023-02-24 19:41:43 +01:00
|
|
|
-- {{{ Ctrl-z to expand window
|
|
|
|
K.nmap("<C-z>", function()
|
|
|
|
vim.opt.lines = 25
|
2023-02-24 14:35:01 +01:00
|
|
|
end, "Expand the neovim window!")
|
2023-02-24 19:41:43 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Filetype detection
|
2023-02-24 14:35:01 +01:00
|
|
|
vim.api.nvim_create_autocmd("BufEnter", {
|
|
|
|
pattern = { "firenvim_localhost_notebooks*.txt" },
|
2023-02-24 19:41:43 +01:00
|
|
|
group = vim.api.nvim_create_augroup("JupyterMarkdownFiletype", {}),
|
2023-02-24 14:35:01 +01:00
|
|
|
callback = function()
|
|
|
|
vim.opt.filetype = "markdown"
|
|
|
|
end,
|
|
|
|
})
|
2023-02-24 19:41:43 +01:00
|
|
|
-- }}}
|
2023-02-26 00:42:40 +01:00
|
|
|
-- {{{ Disable status line
|
2023-02-19 02:41:22 +01:00
|
|
|
vim.opt.laststatus = 0
|
2023-02-26 00:42:40 +01:00
|
|
|
-- }}}
|
2023-03-16 22:22:06 +01:00
|
|
|
-- {{{ Blacklist websites
|
2023-03-17 00:54:34 +01:00
|
|
|
blacklist("web\\.whatsapp\\.com")
|
|
|
|
blacklist("twitter\\.com")
|
|
|
|
blacklist("desmos\\.com\\/calculator")
|
2023-03-20 08:42:43 +01:00
|
|
|
blacklist("geogebra\\.org\\/calculator")
|
2023-05-24 03:17:09 +02:00
|
|
|
blacklist("google\\.com\\/search")
|
|
|
|
blacklist("github\\.com\\/.*\\/blob")
|
2023-03-17 00:54:34 +01:00
|
|
|
-- }}}
|
|
|
|
-- {{{ Comitting our config changes
|
|
|
|
vim.g.firenvim_config = { localSettings = M.localSettings }
|
2023-03-16 22:22:06 +01:00
|
|
|
-- }}}
|
2023-01-10 02:38:06 +01:00
|
|
|
end
|
|
|
|
|
2023-03-17 00:54:34 +01:00
|
|
|
function M.setup()
|
|
|
|
M.config()
|
|
|
|
print(vim.inspect(M.localSettings))
|
|
|
|
end
|
|
|
|
|
2023-01-10 02:38:06 +01:00
|
|
|
return M
|