Reputation: 31
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 }
Upvotes: 1
Views: 3323
Reputation: 11171
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.
Upvotes: 4