I wanted to experiment with LÖVE. After reading this Reddit post, I realized that it's not so easy to get started with LÖVE and Neovim. Perhaps the trickiest part is getting LSP to work with LÖVE. It's just one line in the LSP, but it's usually a very niche thing and I can't find many examples about it; moreover, the ${3rd}
libraries will be deprecated in favor of Addons.
Being able to start and stop the game directly from Neovim (with keybindings) is also quite handy. So I decided to pack these functionalities (LSP LÖVE config and game start/stop) into a dead simple plugin (so simple that it can barely be considered a plugin).
However, I believe that providing this simple codebase to explore can be a good introduction to the inner workings of Neovim plugins. People using LÖVE know Lua, so the language barrier boils down to the Neovim specific API.
- Neovim >= 0.9
- LÖVE
- lua_ls configured with nvim-lspconfig (optional)
-- using lazy.nvim
{
"S1M0N38/love2d.nvim",
cmd = "LoveRun",
opts = { },
keys = {
{ "<leader>v", ft = "lua", desc = "LÖVE" },
{ "<leader>vv", "<cmd>LoveRun<cr>", ft = "lua", desc = "Run LÖVE" },
{ "<leader>vs", "<cmd>LoveStop<cr>", ft = "lua", desc = "Stop LÖVE" },
},
}
Read the documentation with :help love2d
Vim/Neovim plugins are usually shipped with :help documentation. Learning how to navigate it is a really valuable skill. If you are not familiar with it, start with
:help
and read the first 20 lines.
- Reddit post for the idea
- Lua Language Server LÖVE addon
- My Awesome Plugin template