Snippet Engine for Neovim written in Lua.
- 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)
- 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
- Insert key if jumping/expanding/switching choices is not possible:
imap <silent><expr> <Tab> luasnip#expand_or_jumpable() ? '<Plug>luasnip-expand-or-jump' : '<Tab>' imap <silent><expr> <C-E> luasnip#choice_active() ? '<Plug>luasnip-next-choice' : '<C-E>'
- Only try expanding the Snippet/jumping:
imap <silent><expr> <C-l> <cmd>lua require'luasnip'.expand_or_jump()<Cr> inoremap <silent> <S-Tab> <cmd>lua require'luasnip'.jump(-1)<Cr>
- Mappings for Jumping in Select:
snoremap <silent> <Tab> <cmd>lua ls.jump(1)<Cr> snoremap <silent> <S-Tab> <cmd>lua ls.jump(-1)<Cr>
- Add Snippets: Snippets have to be added to the
require'luasnip'.snippets
-table.Examples
contains more details, for actual snippets take a look at my Snippets.
Inspired by vsnip.vim