IDE and terminal snippets
What is LuaSnip? An introduction to L3MON4D3's snippet engine for Neovim
LuaSnip is a snippet engine for Neovim written in Lua. It parses LSP-style snippets from Lua, VS Code packages or SnipMate collections, and it can also take snippets defined directly in Lua.
- Tool
- LuaSnip
- Made by
- L3MON4D3
- Official site
- github.com/L3MON4D3/LuaSnip
- Category
- IDE and terminal snippets
Who makes LuaSnip
LuaSnip is made by L3MON4D3. The official website is the project's GitHub repository, linked below.
Official website: github.com/L3MON4D3/LuaSnip
What LuaSnip is for
LuaSnip is for expanding snippets inside Neovim. It reads snippets in several formats, so you can bring existing material with you instead of rewriting it. Supported sources include Lua definitions, VS Code packages and SnipMate collections.
It also keeps a snippet history, so you can return to older snippets. For files that mix languages, it can resolve the filetype at the cursor using Treesitter, so the snippets offered match the code under the cursor rather than only the buffer's overall filetype.
Who LuaSnip is for
The vendor states the audience as Neovim users. It requires Neovim 0.9 or newer, so it is aimed at people on a reasonably current Neovim.
Writing snippets in Lua suits users who want to configure their editor in Lua. People who prefer simpler formats can use SnipMate-format snippets, which are described as simple to write, or load existing VS Code-style snippet plugins.
Notable capabilities
LuaSnip supports several snippet formats and several ways of loading them. Full functionality needs Lua-defined snippets, but most snippets can use LSP syntax.
- Parsing of LSP-style snippets from Lua, VS Code packages or SnipMate collections.
- Loading of existing VS Code-style snippet plugins.
- SnipMate-format snippet support, described as simple to write.
- Adding snippets directly from Lua, with advanced node types for more complex snippets.
- A snippet history for returning to older snippets.
- Filetype resolution at the cursor using Treesitter.
- Hot reload in the Lua loader within the same Neovim instance.
- Integration with nvim-cmp through cmp_luasnip.
How LuaSnip fits IDE and terminal snippets
In the category of IDE and terminal snippets, LuaSnip is an editor-side engine for Neovim. It expands snippets where you type code, rather than storing or sharing them as a separate service.
In Snipspire's wider niche of snippet managers, code paste and developer snippet tools, it covers the in-editor expansion layer. Its support for several snippet formats means it can sit between existing snippet collections and Neovim.
Setup involves a few requirements. Neovim 0.9 or newer is needed, and jsregexp is needed for LSP snippet transformations. Installation works with plugin managers such as vim-plug, Packer or lazy. The project follows semantic versioning, and DOC.md is the main reference documentation.
Frequently asked questions
What is LuaSnip used for?
LuaSnip is used to expand snippets in Neovim. It parses LSP-style snippets from Lua, VS Code packages or SnipMate collections.
What does LuaSnip require?
It requires Neovim 0.9 or newer, plus jsregexp for LSP snippet transformations.
Does LuaSnip work with nvim-cmp?
Yes. It works with nvim-cmp through cmp_luasnip.
Can LuaSnip load VS Code snippets?
Yes. It can load existing VS Code-style snippet plugins and parse snippets from VS Code packages. It also supports SnipMate-format snippets.
Where is the LuaSnip documentation?
DOC.md is the main reference documentation. The project follows semantic versioning.
Snipspire is independent and is not affiliated with L3MON4D3. Product names belong to their owners. Features change; confirm details on the official website.