# l3mon4d3/luasnip

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/l3mon4d3-luasnip).**

4,276 stars · 265 forks · Lua · apache-2.0

## Links

- GitHub: https://github.com/L3MON4D3/LuaSnip
- awesome-repositories: https://awesome-repositories.com/repository/l3mon4d3-luasnip.md

## Topics

`lua` `neovim` `snippet-engine` `snippets`

## Description

LuaSnip is a scriptable text expansion framework and Lua-based snippet engine. It allows for the creation of reusable text templates and complex nested structures that expand into a buffer using triggers and jumpable tabstops.

The system distinguishes itself by using abstract syntax trees to trigger expansions based on structural code patterns rather than simple text matching. It features a multi-format importer capable of parsing snippet definitions from community standards such as LSP and SnipMate.

The framework covers dynamic code generation through Lua functions, regex-based capture grouping, and interactive choice nodes for cycling through text options. It also provides context-aware expansion based on file types and syntax tree positions, alongside postfix buffer transformations to wrap or alter existing text.

The engine supports lazy-loading of snippet collections from external files and directories to optimize memory usage.

## Tags

### Development Tools & Productivity

- [Neovim Snippet Engines](https://awesome-repositories.com/f/development-tools-productivity/code-editors-ides/snippet-management/code-snippet-repositories/scriptable-snippet-frameworks/neovim-snippet-engines.md) — Ships a scriptable Lua-based snippet engine for Neovim with tabstops, dynamic content, and tree-sitter integration.
- [Choice Node Cycling](https://awesome-repositories.com/f/development-tools-productivity/choice-node-cycling.md) — Switches between alternative text options within a choice node while editing a snippet. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Snippet Expanders](https://awesome-repositories.com/f/development-tools-productivity/code-completion/snippet-expanders.md) — Expands Lua-defined text templates with tabstops and placeholders for interactive editing. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/.gitmodules))
- [Auto-Trigger Snippets](https://awesome-repositories.com/f/development-tools-productivity/code-completion/snippet-expanders/auto-trigger-snippets.md) — Expands a snippet automatically as soon as the trigger text is typed, without a key press. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Snippet Templates](https://awesome-repositories.com/f/development-tools-productivity/code-editors-ides/snippet-management/code-snippet-repositories/snippet-templates.md) — Defines text expansion patterns with placeholders, tabstops, and dynamic content for code insertion. ([source](https://github.com/L3MON4D3/LuaSnip/search))
- [Snippet Syntax Parsing](https://awesome-repositories.com/f/development-tools-productivity/external-format-conversion/snippet-syntax-parsing.md) — Parses snippet definitions from LSP, VSCode, and SnipMate formats into a unified engine.
- [Choice Presentation Nodes](https://awesome-repositories.com/f/development-tools-productivity/interactive-execution-interfaces/dialogue-interaction-engines/choice-presentation-nodes.md) — Provides interactive choice nodes that let users switch between alternative text options during snippet editing. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Contextual Snippet Activation](https://awesome-repositories.com/f/development-tools-productivity/per-filetype-settings/contextual-snippet-activation.md) — Activates specific snippet collections based on detected file type or syntax tree position. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Postfix Buffer Transformations](https://awesome-repositories.com/f/development-tools-productivity/postfix-buffer-transformations.md) — Wraps text immediately before the trigger with a template for IDE-style postfix completions. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Snippet Collection Loading](https://awesome-repositories.com/f/development-tools-productivity/snippet-collection-loading.md) — Reads snippet definitions from VSCode, SnipMate, or Lua files on disk and registers them for the appropriate filetypes. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Programmatic Snippet APIs](https://awesome-repositories.com/f/development-tools-productivity/snippet-management-tools/programmatic-snippet-apis.md) — Provides a programmatic API to register new snippets via the add_snippets function. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Text Expansion Snippets](https://awesome-repositories.com/f/development-tools-productivity/text-expansion-snippets.md) — Creates text-expansion snippets by pairing a trigger pattern with a tree of nodes. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Lua-Based Snippet Templates](https://awesome-repositories.com/f/development-tools-productivity/text-expansion-snippets/lua-based-snippet-templates.md) — Builds reusable text templates using Lua scripting for complex, context-aware snippet generation.
- [Interactive Snippet Expansion](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/interactive-snippet-expansion.md) — Navigates through tabstops, choices, and computed fields within an expanded snippet for efficient text entry.
- [Conditional Expansion Predicates](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/interactive-snippet-expansion/conditional-expansion-predicates.md) — Applies Lua functions or logical conditions that must be true for a snippet to trigger.
- [Scriptable Dynamic Content](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/interactive-snippet-expansion/scriptable-dynamic-content.md) — Runs Lua functions that read other snippet nodes and insert computed results dynamically. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Pattern-Based Triggers](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/snippet-matching/pattern-based-triggers.md) — Matches the text before the cursor against a Lua pattern, ECMAScript regex, or Vim regex and expands the snippet on match. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Regex Triggers](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/snippet-matching/regex-triggers.md) — Fires a snippet when typed text matches a regular expression pattern. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [VSCode-Style Snippet Creators](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/snippet-matching/snippet-creations-from-prompts/vscode-style-snippet-creators.md) — Reads snippet collections from VSCode-style package.json and JSON files and registers them for expansion. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Tree-Sitter Prefix Matchers](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/snippet-matching/tree-sitter-prefix-matchers.md) — Expands a snippet only when a specific tree-sitter node type or query capture precedes the trigger. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Visual Selection Capture](https://awesome-repositories.com/f/development-tools-productivity/visual-selection-capture.md) — Captures the current visual selection into snippet variables (TM_SELECTED_TEXT, LS_SELECT_RAW) for use in expansions. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Node Insertions](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-node-generation/node-insertions.md) — Inserts a copy of the text from a referenced node at the current position. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Snippet Text Repeaters](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-node-generation/node-insertions/snippet-text-repeaters.md) — Inserts the exact content of a referenced node at the current position within a snippet. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [State-Preserving Choice Nodes](https://awesome-repositories.com/f/development-tools-productivity/choice-node-cycling/state-preserving-choice-nodes.md) — Implements choice nodes that retain user edits in shared restore nodes when switching alternatives. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Event Callbacks](https://awesome-repositories.com/f/development-tools-productivity/code-completion/snippet-expanders/event-callbacks.md) — Ships a callback system that fires on node enter, leave, choice change, and pre-expand events. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Nested Snippet Sessions](https://awesome-repositories.com/f/development-tools-productivity/code-editors-ides/snippet-management/code-snippet-repositories/snippet-templates/nested-snippet-sessions.md) — Embeds one snippet inside another so expanding the inner snippet replaces a placeholder. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Placeholder Marker Snippet Definitions](https://awesome-repositories.com/f/development-tools-productivity/code-snippet-generators/boilerplate-snippets/placeholder-marker-snippet-definitions.md) — Writes snippet bodies as strings with delimiters replaced by node objects to reduce boilerplate. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [SnipMate Syntax Parsers](https://awesome-repositories.com/f/development-tools-productivity/external-format-conversion/snippet-syntax-parsing/snipmate-syntax-parsers.md) — Converts a string in the SnipMate format, including backtick evaluation, into a runnable LuaSnip snippet. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Snippet Format Strings](https://awesome-repositories.com/f/development-tools-productivity/format-string-parsers/snippet-format-strings.md) — Provides a format string syntax with placeholder markers to define snippet bodies more readably. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Lazy Snippet Loaders](https://awesome-repositories.com/f/development-tools-productivity/snippet-collection-loading/lazy-snippet-loaders.md) — Defers loading snippet collections until a buffer with a matching filetype is opened to optimize memory usage.
- [Lua File Snippet Loaders](https://awesome-repositories.com/f/development-tools-productivity/snippet-collection-loading/lua-file-snippet-loaders.md) — Reads snippet collections from Lua files that return snippet tables and registers them for expansion. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [SnipMate Collection Loaders](https://awesome-repositories.com/f/development-tools-productivity/snippet-collection-loading/snipmate-collection-loaders.md) — Imports snippet collections formatted for SnipMate, including custom `.snippets` files, into the snippet engine. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/README.md))
- [Editable Computed Text Insertions](https://awesome-repositories.com/f/development-tools-productivity/text-editing-workflows/editable-computed-text-insertions.md) — Inserts lambda-computed text as editable nodes that users can override after expansion. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Computed Value Insertions](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/interactive-snippet-expansion/computed-value-insertions.md) — Evaluates a function once when a snippet expands and inserts the computed return value. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Logical Condition Combinators](https://awesome-repositories.com/f/development-tools-productivity/text-snippet-managers/interactive-snippet-expansion/conditional-expansion-predicates/logical-condition-combinators.md) — Joins multiple expansion conditions with AND, OR, NOT, XOR, or XNOR operators to form complex rules. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))

### Artificial Intelligence & ML

- [Structural AST Triggers](https://awesome-repositories.com/f/artificial-intelligence-ml/code-snippets/ast-snippet-substitutions/structural-ast-triggers.md) — Uses abstract syntax tree patterns as triggers for snippet expansion instead of text matching.
- [AST Node Matching](https://awesome-repositories.com/f/artificial-intelligence-ml/code-snippets/ast-snippet-substitutions/structural-ast-triggers/ast-node-matching.md) — Matches snippet expansions against the abstract syntax tree of the file, enabling context-sensitive completions. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/.gitmodules))
- [Multi-Format Snippet Importers](https://awesome-repositories.com/f/artificial-intelligence-ml/code-snippets/editor-snippets/snippet-loaders/multi-format-snippet-importers.md) — Imports snippet collections from VSCode, SnipMate, and LSP formats into a unified snippet system for cross-editor compatibility.
- [Tabstop Navigation](https://awesome-repositories.com/f/artificial-intelligence-ml/code-snippets/editor-snippets/tabstop-navigation.md) — Defines text templates with numbered placeholders for jumping through after expansion. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua))
- [Tabstop Navigation](https://awesome-repositories.com/f/artificial-intelligence-ml/code-snippets/editor-snippets/tabstop-navigation/tabstop-navigation.md) — Moves the cursor through numbered placeholders within an expanded snippet for sequential text entry.

### Part of an Awesome List

- [Context-Aware Triggers](https://awesome-repositories.com/f/awesome-lists/devtools/completion/context-aware-triggers.md) — Triggers snippet expansions based on abstract syntax tree patterns rather than simple text matching.
- [LSP Snippet String Parsers](https://awesome-repositories.com/f/awesome-lists/devtools/snippet-management/lsp-snippet-delivery/lsp-snippet-string-parsers.md) — Converts a string in the LSP snippet format into a LuaSnip snippet or snippet node. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Lua Snippet Definitions](https://awesome-repositories.com/f/awesome-lists/devtools/snippet-management/lsp-snippet-delivery/snippet-support-toggles/lua-snippet-definitions.md) — Creates snippets programmatically using Lua code with function, dynamic, choice, and restore nodes. ([source](https://github.com/L3MON4D3/LuaSnip#readme))
- [Snippet Management](https://awesome-repositories.com/f/awesome-lists/devtools/snippet-management.md) — Lua-based snippet engine.

### Content Management & Publishing

- [Dynamic Snippet Content Generation](https://awesome-repositories.com/f/content-management-publishing/dynamic-text-generation/dynamic-snippet-content-generation.md) — Runs Lua code at expansion time to produce snippet content that adapts to editor state or user input.
- [Snippet Placeholder References](https://awesome-repositories.com/f/content-management-publishing/text-placeholder-replacements/snippet-placeholder-references.md) — Inserts the content of one placeholder into another location using lambdas or function nodes. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/Examples/snippets.lua))

### DevOps & Infrastructure

- [Snippet Environment Variables](https://awesome-repositories.com/f/devops-infrastructure/environment-variables/node-environment-variable-viewers/snippet-environment-variables.md) — Provides LSP-style variables (TM_CURRENT_LINE, TM_SELECTED_TEXT, etc.) and custom namespaced variables inside snippet nodes. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Snippet](https://awesome-repositories.com/f/devops-infrastructure/environment-variables/snippet.md) — Reads LSP‑defined variables (TM_CURRENT_LINE, TM_FILENAME, etc.) and custom variables inside snippet functions. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))

### Programming Languages & Runtimes

- [Snippet Frameworks](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/dynamic-scripting-languages/lua/snippet-frameworks.md) — Creates reusable text templates with Lua scripting, supporting dynamic content, tabstops, and interactive fields.

### Software Engineering & Architecture

- [Runtime Node Evaluations](https://awesome-repositories.com/f/software-engineering-architecture/trees/tree-node-templates/runtime-node-evaluations.md) — Expands snippets by evaluating a tree of nodes that can include functions, lambdas, and interactive fields at runtime.
- [Behavioral Configuration](https://awesome-repositories.com/f/software-engineering-architecture/default-configuration-values/mock-default-behavior-configurations/behavioral-configuration.md) — Sets global preferences such as root linking, autosnippet enabling, update events, and filetype functions. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Event-Driven Callbacks](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-callbacks.md) — Attaches functions that run on node entry, exit, or choice changes to react to snippet lifecycle events.

### Data & Databases

- [Postfix Prefix Matchers](https://awesome-repositories.com/f/data-databases/document-extraction-tools/code-symbol-extractors/tree-sitter-parsers/postfix-prefix-matchers.md) — Triggers a postfix snippet only when a specific tree‑sitter node sits in front of the trigger. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))

### Web Development

- [Conditional Fallback Insertions](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/conditional-fallback-insertions.md) — Inserts conditional fallback text based on whether a referenced snippet node is empty. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Editable Computed Text Insertions](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/editable-computed-text-insertions.md) — Inserts lambda-computed text as editable nodes that users can override after expansion. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Node Content Conditional Insertions](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/node-content-conditional-insertions.md) — Inserts text conditionally by checking a predicate against a snippet node's content. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Predicate-Based Conditional Insertions](https://awesome-repositories.com/f/web-development/content-insertion-utilities/dynamic-content-insertion/predicate-based-conditional-insertions.md) — Inserts text conditionally by evaluating a predicate against referenced node content. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
- [Snippet Engine Configurations](https://awesome-repositories.com/f/web-development/global-configuration/snippet-engine-configurations.md) — Sets options like root linking, autosnippet enabling, update events, and filetype resolution in a central setup call. ([source](https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md))
