I work a bit on a lua project (not small, but most of the code is not my own), and I'd like to get tags working. Current ctags contains bug, which can be fixed by getting the latest code from svn apparently, but even without that bug, it's not very usefull to me, since it does not know about the structure of tables. To give an example, a file might contain

function table1:func1(arg1,arg2)

and then I have a call


somewhere in my code. When the cursor is on table1:func1, Ctrl-] should take me to the first mentioned file (assuming it's uniqe or the first in the list), but actually it can't find the tag. Using :ts /table1:func1 kinda does the job, but isn't nice to use.

So, long story short, does someone have a nice working setup for working with lua? How did you deal with the tag thing? I found some plugins that look kinda nice, but nothing seems to include a remedy to the tag problem.

  • You might need to run set iskeyword+=: so that vim will make : a keyword character. Vim only searches for the keyword under the cursor when <c-]> is hit.
    – FDinoff
    Commented Mar 31, 2015 at 23:31
  • Hey that did it indeed, thanks! Make it an answer if you want, I'd accept it :) Commented Apr 2, 2015 at 19:46

1 Answer 1


<c-]> only looks at the keyword under the cursor. Normally : is not defined as a keyword character. To define : as a keyword character you can put

setlocal iskeyword+=:

in ~/.vim/ftplugin/lua.vim so that this happens automatically for lua files (and only for lua files)

Or if you just want to add something to your vimrc, you can add the following

augroup filetype_lua
    autocmd FileType lua setlocal iskeyword+=:
augroup END

This creates an autocmd that only activates on the lua filetype to set the : as a keyword character. The augroup command creates a autocmd group which stops the autocmd from being defined multiple times if you resource your vimrc.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.