in my config of init.lua ,I want to load a luafile from anywhere or any directory

so : can I source it without function vim.cmd()

vim.cmd('luafile /full/path/to/file.lua')
  • Can you use the require function?
    – filbranden
    Aug 24, 2021 at 2:11
  • Or dofile?
    – filbranden
    Aug 24, 2021 at 2:20
  • yah is require function, it works for file in subdirectory fine , but I can't resource for example from home e.g ~/test.lua or /opt/test.lua
    – nextloop
    Aug 24, 2021 at 2:41


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.