javadoc.mp4
- 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)
- Snippets that make use of the entire functionality of this plugin have to be defined in Lua.
Neovim >= 0.5 (extmarks)
- 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.
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