glacambre / firenvim

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

firenvim has weird problem on firefox #1538

Open gaofengnan opened 1 year ago

gaofengnan commented 1 year ago

What I tried to do

I tried to use it in Firefox.

What happened

I spent the past two hours trying to figure out why Firenvim does not work in Firefox, while knowing that it works well in my Edge. What I discovered was that if I comment out the following lines in my init.vim, it works in Firefox.

  let g:firenvim_config = {
      \ 'globalSettings': {
          \ 'alt': 'all',
      \  },
      \ 'localSettings': {
          \ '.*': {
              \ 'cmdline': 'neovim',
              \ 'priority': 0,
              \ 'selector': 'textarea',
              \ 'takeover': 'never',
          \ },
      \ }
  \ }

Please note that it works in Edge regardless whether these above lines are commented out. But why? It makes no sense. Especially since the same above setting works well on Firefox in my Windows machine. I don't have /tmp/stdin or /tmp/stdout on my problematic Mac machine, in case you would ask me for them.

What is even more peculiar is that even when it works (when the above config is commented out), it does not work well. For instance, when I click in a text box, firenvim jumps out (which is not what I desire but the config file to disable such behaviour is commented out), but when I :x to close the nvim instance, I cannot call it by the add-on shortcut. Only if I go to another tab and come back, a new nvim instance pops up.

None of the weird things happened on my Windows machine, and I don't know what is wrong.

glacambre commented 1 year ago

I think the problem might that you have windows-style line endings in your init.vim while you need them to be unix-style on mac/linux. Could you open your init.vim in neovim, run :set ff=unix, :write the file, close it and then restart your browser and attempt to use firenvim again?

gaofengnan commented 1 year ago

I think the problem might that you have windows-style line endings in your init.vim while you need them to be unix-style on mac/linux. Could you open your init.vim in neovim, run :set ff=unix, :write the file, close it and then restart your browser and attempt to use firenvim again?

No, I just tried. I have attached both my vimrc and init.vim files. vimrc.txt init.vim.txt