Go to file
L3MON4D3 6bc0063331 Add stylua-config (closes #30). 2021-06-11 23:23:31 +02:00
Examples Remove old example-gifs. 2021-06-07 23:49:47 +02:00
doc Improve formatting (tabs+spaces). 2021-06-05 22:57:05 +02:00
lua/luasnip A functionNode may be entered as a choice, use the textNode-input_enter. 2021-06-02 17:38:32 +02:00
plugin Add option to choose which events update dependent nodes. 2021-05-31 13:51:55 +02:00
.stylua.toml Add stylua-config (closes #30). 2021-06-11 23:23:31 +02:00
LICENSE Create LICENSE 2021-04-04 19:26:27 +02:00
README.md fix: remove ls global usage 2021-06-11 15:00:25 -04:00

README.md

LuaSnip

https://user-images.githubusercontent.com/41961280/121092275-940c2d00-c7eb-11eb-9e77-869b1cb08f1a.mp4

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 via LuasnipUnlinkCurrent.
  • 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