1

I have a init.vim file and have some embedded lua that was working perfectly fine until just now. It keeps giving me the error below:

Error loading lua [string ":lua"]:5: '}' expected (to close '{' at line 3) near '['

I have double and triple checked that there are no curly parentheses left opened (or maybe i'm just blind) but it still seems to throw the error. Here is the code:

  1 local servers = {'clangd'}
  2 require('neorg').setup {
  3     load = {
  4         ["core.defaults"] = {}
  5         ["core.norg.dirman"] = {
  6             config = {
  7                 workspaces = {
  8                     dev = "~/notes/dev",
  9                     school = "~/notes/school",
 10                 }
 11             }
 12         }
 13
 14     }
 15 }

1 Answer 1

4

You forgot a comma on line 4:

  4         ["core.defaults"] = {}, -- note the added trailing comma
  5         ["core.norg.dirman"] = {

to separate it from line 5.

Lua thinks that rather than forgetting to add a comma you forgot to close the table - it can't tell your intention. In general, when looking for syntax errors, always carefully reread the lines in question - don't limit your search to what the error message says (although you should take the error message as a first hint) since error messages may be inaccurate.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.