glacambre / firenvim

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

Unable to disable takeover for particular sites, a.k.a. blacklist #1535

Closed VAggrippino closed 1 year ago

VAggrippino commented 1 year ago
vim.g.firenvim_config.localSettings["https://techhub\.social/"] = { takeover = 'never', priority = 1 }

What happened

The following error message appears when running nvim in the terminal and firenvim doesn't work anywhere:

E5112: Error while creating lua chunk: C:\Users\vince\AppData\Local\nvim\init.lua:90: invalid escape sequence near '"https://techhub'

The same thing happens when I try exactly the .co.uk example from the README.

I've tried a few other things:

Inspired by #1401 :

vim.cmd[[
  let g:firenvim_config = {
  \ 'localsettings': {
  \   '.*': {
  \     'priority': 0,
  \     'takeover': 'always'
  \   },
  \   'https://techhub.social': {
  \     'priority': 1,
  \     'takeover': 'never'
  \   }
  \ }
  \}
]]

Result: No error, but firenvim takes over everywhere.

... or ...

vim.g.firenvim_config = {
  localSettings = {
    '.*': {
      priority = 0,
      takeover = 'always'
    },
    'https://techhub.social': {
      priority = 1,
      takeover = 'never'
    }
  }
}

Result:

E5112: Error while creating lua chunk: C:\Users\vince\AppData\Local\nvim\init.lua:79: '}' expected (to close '{' at line 78) near ':'

Firenvim doesn't work, but submit buttons are disabled.

Note: Line 78 is the first line of this block and I've double- and triple-checked that all curly braces are balanced.

glacambre commented 1 year ago

invalid escape sequence near '"https://techhub'

Thanks for reporting this. This problem was introduced when I translated the examples from VimScript to Lua, I fixed it now.

vim.cmd[[

Your example seems correct, but I'm noticing your have a double h in techhub instead of a single one like for the other examples. This might be the reason the pattern doesn't work?

'}' expected (to close '{' at line 78) near ':'

This is because you are using a colon in 'https://techhub.social': {. It should be 'https://techhub.social' = { instead, as the Lua syntax uses equals signs instead of colons in order to describe objects. Let me know if that solves your issue.