Lua jump to the right

I have a make file that looks like this:

default:
  lua blah.lua

Now, in Vim, I type ": make".

There is an error in my Lua code; it gives the file name + line number. I would like Vim to go to the desired file / line. How to do it?

+5
source share
1 answer

You can set the error format string to recognize the output of the lua interpreter. For example, add this to your .vimrc file:

autocmd BufRead *.lua setlocal efm=%s:\ %f:%l:%m

This suggests that the errors in your version of Lua look like this:

lua: blah.lua:2: '=' expected near 'var'

Bonus tip: instead of using the makefile, you can use the parameter makeprg:

autocmd BufRead *.lua setlocal makeprg=lua\ %

This will cause the current file to run through lua as you type :make.

+7
source

All Articles