hsnips icon indicating copy to clipboard operation
hsnips copied to clipboard

Include external files in .hsnips

Open DedZago opened this issue 2 years ago • 0 comments

Hello, I was wondering whether it would be possible to include external files in .hsnips file, so that we avoid copy-pasting when multiple filetypes share the same snippets. UltiSnips does this via the use of the extends keyword.

Use case: I have the same mathematical snippets for both quarto files (quarto.hsnips) and RMarkdown files (rmd.hsnips). It would be nice to be able to create an external math.hsnips file to contain the snippets that are shared between them:

math.hsnips:

# Mathematical snippets that are shared between multiple filetypes
snippet dm "math" iA
\[
    $1
\]$0
endsnippet

rmd.hsnips:

# Snippets that are specific for RMarkdown
#...

extends math

quarto.hsnips:

# Snippets that are specific for quarto
#...

extends math

Thank you for your time.

DedZago avatar Jun 24 '22 09:06 DedZago