I use UltiSnips
to manage my snippets and I have a few snippets in typescriptreact
but I'm not able to use them in typescript
.
Is there a way to share snippets between them?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityThere are a couple of ways to share snippets:
extends
For the first method, set the dotted filetype with
:set ft=typescriptreact.typescript
and you can use both typescriptreact
and typescript
snippets for the current buffer.
(See the end of the section :h UltiSnips-how-snippets-are-loaded
for details)
The second method allows the use of both snippets for all files of a certain filetype (not just for a certain buffer). To use typescriptreact
snippets in a typescript
file, add the line
extends typescriptreact
to the typescript
snippets file. Now, when UltiSnips activates snippets for a typescript
file, it looks for all typescripteact
snippets and activates them as well.
(See the top of :h UltiSnips-basic-syntax
for details)