glacambre / firenvim

Embed Neovim in Chrome, Firefox & others.
GNU General Public License v3.0
4.65k stars 143 forks source link

How to setup isolated Firenvim-specific config? #1555

Closed eisukeesaki closed 11 months ago

eisukeesaki commented 1 year ago

runtime environment

Kernel Version: Linux 6.4.9-arch1-1 Neovim Version: NVIM v0.9.1 Browser Version: 116.0.2 (64-bit) Browser Addon Version: 0.2.15 Neovim Plugin Version: 0.2.15

What I want to achieve

Set the takeover setting to never) using a Firenvim-specific config (in ~/.config/firenvim/init.lua) isolated from ~/.config/nvim.

What I have tried

Summary

The Neovim frame is still automatically shown in the browser despite the attempt to alter that behavior.

What am I doing wrong?

glacambre commented 1 year ago

Hi, thanks for opening this issue. Let's do things one step at a time first. We'll begin with stopping Firenvim from running in your default config. If you open the browserAction (the Firenvim icon next to your URLbar), you'll probably see error messages about vim.g.firenvim_config not existing. If you try to replace your firenvim config in ~/.config/nvim/init.lua with

if vim.g.started_by_firenvim == true then
    vim.g.firenvim_config = {
        localSettings = {
            [".*"] = {
                takeover = "never"
            }
        }
    }
end

The error message should disappear and firenvim should stop appearing by default. Can you confirm that this works?

eisukeesaki commented 1 year ago

I did as you said, and the desired behavior (disable takeover by default) was achieved. Are there any downsides to overwriting the entire vim.g.firenvim_config? I tried to see what is inside it before it is overwritten, but the result of print() was not printed when I manually activated the Neovim frame in the browser.

if vim.g.started_by_firenvim == true then
        print(vim.g.firenvim_config)
    vim.g.firenvim_config = {
        localSettings = {
            [".*"] = {
                takeover = "never"
            }
        }
    }
end
eisukeesaki commented 1 year ago

Apologies if I confused you. I just meant to let you know that: after following what you said, Firenvim no longer shows up automatically.

glacambre commented 1 year ago

Are there any downsides to overwriting the entire vim.g.firenvim_config?

There are no downsides, vim.g.firenvim_config isn't defined by default :)

I just meant to let you know that: after following what you said, Firenvim no longer shows up automatically.

Great! Now, if you are still interested in having a Firenvim-only config, here's how to do it:

That should be it! The neovim you run in your browser should be using your config defined in ~/.config/firenvim/init.lua .

github-actions[bot] commented 11 months ago

Closing this issue because it has been awaiting a response from its author for more than a month. Please provide the requested information and this issue will be re-opened.