2

This seems like a trivial thing to accomplish, but I'd like to run a lua script alongside a vimscript (in the same directory).

First I tried

luafile ./somefile.lua

which doesn't work. I looked up how to get the current vimscript's directory and tried

let s:path = fnamemodify(resolve(expand('<sfile>:p')), ':h')
let s:vglua = s:path . "/somefile.lua"
luafile s:vglua

which, unsurprisingly, results in

cannot open s:vglua: No such file or directory

I know I'm doing something stupid, but Vim's helpfiles are huge and I'm not seeing anything really helpful from my initial search queries.

How would I go about running a Lua script that's in the same directory as my vimscript?

Community
  • 1
  • 1
Qix - MONICA WAS MISTREATED
  • 13,194
  • 13
  • 82
  • 139

1 Answers1

2

Supposing s:vglua is correctly defined, you must:

execute "luafile " . s:vglua
romainl
  • 172,579
  • 20
  • 259
  • 291