Vim / Syntastic Configuration

I'm just getting started working with the Playdate SDK and discovered that there's not much info on setting up for a vim-based dev environment, so thought I'd start a thread to compile that information.

First thing I was looking for was a Syntastic syntax checker. Due to the SDK's lua superset that adds things like +=, etc it's not perfect, but at the very least you should set the Syntastic lua checker in your .vimrc to use Lua 5.4's luac compiler to get things like <const> and other current language features. You'll only need to do this if lua v5.4 is not the default version of lua that comes installed on your system. I'm on Debian Buster, which ships with lua 5.1, but has an available package for 5.4.

let g:syntastic_lua_luac_exec = '/path/to/lua/v5.4/luac'

Syntastic also provides luacheck as a complement to using luac, but it focuses on static analysis. I'm not sure if that's a good idea to enable it in this case, but might experiment with it in the future.

1 Like