Skip to content

Snippetsλ︎

LuaSnip can use several different sources for snippets

LuaSnip Configuration

Practicalli Neovim Config Redux includes the LuaSnip package which also adds friendly-snippets and cmp_luasnip.

  ; snippets
  :L3MON4D3/LuaSnip
  {:requires [:rafamadriz/friendly-snippets
              :saadparwaiz1/cmp_luasnip]
   :mod :lua-snip}
Configure LSP snippet locations
{
  "name": "practicalli-snippets",
  "engines": {
    "vscode": "^1.11.0"
  },
  "contributes": {
    "snippets": [
      {
        "language": [
          "markdown",
          "global",
          "all"
        ],
        "comment": "snippets accross several languages",
        "path": "./global.json"
      },
      {
        "language":
          "markdown",
        "path": "./markdown.json"
      }
    ]
  }
}

Snippet Definitionsλ︎

snippets directory contains snippet definitions, with a JSON file for each language, e.g. markdown.json

Practicalli Neovim Config Redux contains several groups of snippet definitions

  • MkDocs format and icons (markdown.json VSCode syntax)

Restart Neovim to load new defintions

Snippets added to VSCode JSON snippets are only loaded when Neovim starts, so newly added snippets will only be available after Neovim is restarted.