smjonas / snippet-converter.nvim

Bundle snippets from multiple sources and convert them to your format of choice.
Mozilla Public License 2.0
170 stars 4 forks source link

merge multiple sources of one filetype into single output? #25

Open zhengpd opened 1 year ago

zhengpd commented 1 year ago

It seems multiple sources in one template would not be merged for the same filetype. For example, following config only keeps lua.snippets content from either vim-snippets/snippets or vim-snippets/UltiSnips, but no both.

      templates = {
        {
          name = '1',
          sources = { snipmate = { './vim-snippets/snippets' }, ultisnips = { './vim-snippets/UltiSnips' }  },
          output = {
            snipmate = {
              vim.fn.stdpath('data') .. '/snippet-converter/snippets-1'
            }
          }
        },
    }

So I have to create separate templates and separate outputs like below:

      templates = {
        {
          name = '1',
          sources = { snipmate = { './vim-snippets/snippets' } },
          output = {
            snipmate = {
              vim.fn.stdpath('data') .. '/snippet-converter/snippets-1'
            }
          }
        },
        {
          name = '2',
          sources = { ultisnips = { './vim-snippets/UltiSnips' } },
          output = {
            snipmate = {
              vim.fn.stdpath('data') .. '/snippet-converter/snippets-2'
            }
          }
        },
    }

It could be convenient if snippets from sources in single template could be merged.