Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load UltiSnips file types by default in JS files?

I know that doing :UltiSnipsAddFiletypes javascript-node in vim console works. But I need this load automatically whenever I open a javascript file. Regardless documentation, I understood that I should create a ftplugin/javascript.vim file and put :UltiSnipsAddFiletypes javascript-node in first line. The thing is those snippets are not loaded.

So, how can make this works please?

like image 505
Stevens Garcia Avatar asked Nov 26 '25 21:11

Stevens Garcia


2 Answers

You can use an autocmd in your .vimrc:

autocmd FileType javascript UltiSnipsAddFiletypes javascript-node
like image 124
tckmn Avatar answered Nov 29 '25 10:11

tckmn


Just to add on to @tckmn 's answer, I used this for multiple filetypes, keeping in mind that UltiSnipsAddFiletypes uses . as a delimiter:

autocmd FileType javascript,javascriptreact,typescript,typescriptreact
  \ UltiSnipsAddFiletypes javascript.javascriptreact.typescript.typescriptreact

like image 31
zzzachzzz Avatar answered Nov 29 '25 12:11

zzzachzzz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!