mirror of https://github.com/L3MON4D3/LuaSnip
6bc0063331 | ||
---|---|---|
Examples | ||
doc | ||
lua/luasnip | ||
plugin | ||
.stylua.toml | ||
LICENSE | ||
README.md |
README.md
LuaSnip
Features
- Tabstops
- Text-Transformations using Lua functions
- Conditional Expansion
- Defining nested Snippets
- Filetype-specific Snippets
- Choices
- Dynamic Snippet creation
- Regex-Trigger
- Fast, small, simple
- Parse LSP-Style Snippets (Does not, however, support Regex-Transformations)
- Expand LSP-Snippets with nvim-compe
- Snippet history (jump back into older snippets)
Drawbacks
- Snippets that make use of the entire functionality of this plugin have to be defined in Lua.
Requirements
Neovim >= 0.5 (extmarks)
Setup
- Install using eg. vim-plug
- Add mappings (Example from my config)
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>' inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr> snoremap <silent> <Tab> <cmd>lua require('luasnip').jump(1)<Cr> snoremap <silent> <S-Tab> <cmd>lua require('luasnip').jump(-1)<Cr> imap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>' smap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
- Add Snippets: Snippets have to be added to the
require'luasnip'.snippets
-table.Examples
contains more details, for actual snippets take a look at examples or my Snippets.
For Supertab-like functionality with compe, check out #1.
Config
history
: If true, Snippets that were exited can still be jumped back into. As Snippets are not removed when their text is deleted, they have to be removed manually viaLuasnipUnlinkCurrent
.updateevents
: Choose which events trigger an update of the active nodes' dependents. Default is just'InsertLeave'
,'TextChanged,TextChangedI'
would update on every change.
Inspired by vsnip.vim