Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim UltiSnips - 2 File Types for 1 Snippet File

Can I map two file types to one snippet file?

For example, I would like both .html and .ctp files to use the hmtl.snippets file.

If not, would a sym link from the operating system do the trick?

Or can I create a global snippet file for all file types?

Thanks!

like image 362
Bryan Avatar asked Dec 02 '22 21:12

Bryan


2 Answers

What romainl said. Additionally, you could create a ctp.snippets file and put an extends html command in it. All of this is well documented in UltiSnips' vimhelp.

like image 174
wataya Avatar answered Mar 05 '23 10:03

wataya


You can (at the very least):

  • use a symlink
  • duplicate html.snippets and rename it to ctp.snippets
  • add your general snippets to _.snippets
  • add autocmd BufEnter,BufNew *.ctp setf ctp.html to your ~/.vimrc
like image 41
romainl Avatar answered Mar 05 '23 09:03

romainl