No description
Find a file
2021-04-04 19:26:27 +02:00
autoload Add viml-bindings. 2021-03-20 22:11:51 +01:00
Examples Add Example for wordTrig and regTrig. 2021-04-04 00:13:51 +02:00
lua Add regex-snippets and an easy way to have snippets expand only if the 2021-04-04 00:00:53 +02:00
plugin Add 'jumpable' to check if jumping forward/backward is possible. 2021-03-31 15:29:03 +02:00
LICENSE Create LICENSE 2021-04-04 19:26:27 +02:00
README.md Update README.md 2021-04-04 00:26:27 +02:00

LuaSnip

Snippet Engine for Neovim written in Lua. Javadoc

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)

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
    • 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