From 4eee9b4398cd66833965790685e000ef1cc540a9 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 8 Dec 2021 22:34:30 +0100 Subject: [PATCH] Add firenvim (nvim in browser) plugin --- home/.config/nvim/lua/plugins/plugin_list.lua | 5 ++++ .../nvim/lua/plugins/settings/firenvim.lua | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 home/.config/nvim/lua/plugins/settings/firenvim.lua diff --git a/home/.config/nvim/lua/plugins/plugin_list.lua b/home/.config/nvim/lua/plugins/plugin_list.lua index c7e8c28..b2eae55 100644 --- a/home/.config/nvim/lua/plugins/plugin_list.lua +++ b/home/.config/nvim/lua/plugins/plugin_list.lua @@ -57,6 +57,11 @@ local plugin_list = { after = "fzf", requires = { "stsewd/fzf-checkout.vim", opt = true }, }, + { + 'glacambre/firenvim', + config = get_plugin_file("firenvim.lua"), + run = function() vim.fn['firenvim#install'](0) end + }, -- { -- "neovim/nvim-lspconfig", -- "williamboman/nvim-lsp-installer", diff --git a/home/.config/nvim/lua/plugins/settings/firenvim.lua b/home/.config/nvim/lua/plugins/settings/firenvim.lua new file mode 100644 index 0000000..3aa19ce --- /dev/null +++ b/home/.config/nvim/lua/plugins/settings/firenvim.lua @@ -0,0 +1,27 @@ +local vim = require("vim") +local cmd = vim.cmd +local g = vim.g + +-- Detect filetype based on filename for certain websites +cmd[[ +autocmd BufEnter github.com_*.txt set filetype=markdown +autocmd BufEnter txti.es_*.txt set filetype=typescript +]] + +-- Define firenvim configuration +g.firenvim_config = { + globalSettings = { alt="all" }, + localSettings = { + [".*"] = { + cmdline = "neovim", + content = "text", + priority = 0, + selector = "textarea", + -- Don't automatically take over, require the shortcut + takeover = "never", + }, + -- Enable automatic takeover on certain websites where it makes sense + ["https?://github.com"] = { takeover = "always", priority=1 }, + ["https?://txti.es"] = { takeover = "always", priority = 1 }, + } +}