garymjr / nvim-snippets

Snippet support using native neovim snippets
MIT License
215 stars 13 forks source link

Allow duplicate key in snippets #18

Closed imroc closed 3 months ago

imroc commented 3 months ago

I use LuaSnip before, and defined my custom snippets markdown.json:

{
  "Insert code block": {
    "prefix": "cb",
    "body": [
      "```$1",
      "$0",
      "```"
    ],
    "description": "Insert code block"
  }
}

Which uses the same key Insert code block with friendly-snippets:

    "Insert code block": {
        "prefix": "codeblock",
        "body": ["```${1:language}", "$0", "```"],
        "description": "Insert fenced code block"
    },

Both snippets works (prefix cb and codeblock).

But when I switch to nvim-snippets, it not work any more, unless change the key name to another name that not duplicate with friendly-snipppets.

It will be better to support the snippet key name duplication.

garymjr commented 3 months ago

This looks like something I'd like to support. I'll need to refactor how I'm currently storing the snippets once they're parsed, so it could take a few days to get this added.

imroc commented 3 months ago

This looks like something I'd like to support. I'll need to refactor how I'm currently storing the snippets once they're parsed, so it could take a few days to get this added.

Nice, looking forward to this