I'm using neovim 0.6.0 and my config is written in Lua.

My init.lua file requires files such as mappings and plugins. I use packer to manage plugins, and when calling the packer use command I can pass a config file to the command. e.g use {"kyazdani42/nvim-tree.lua", config = get_config("nvim-tree")}.

The get_config() function simply returns a string require("path_to_config_file"). But if I replace config=get_config("<path>") with config=require("<path>") (and am mindful of how/where lua looks for lua files) then I get an error. The require function can find the lua file fine, but Packer throws this error:

async.lua:20: Error in coroutine: .. <path to packer.lua>:697: invalid value (boolean) at index 68 in table for 'concat'

Why is this?

  • 2
    Well, a string containing code and the actual code are different. One evaluates to a string containing code, and the other evaluates to whatever the semantics of lua’s require are (probably a table in the successful case). Try quoting the replacement as a string
    – D. Ben Knoble
    Commented Jan 14, 2022 at 13:17
  • ah, yes. Good spot.
    – john
    Commented Jan 14, 2022 at 19:48


Your Answer

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

Browse other questions tagged or ask your own question.