Closed TroySigX closed 1 year ago
not quite sure what the question is, but maybe you could either make plaintex.snippets
be a symlink to tex.snippets
in .vim/snippets/
, or else put au! BufRead,BufNewFile *.tex set filetype=tex
in .vim/ftdetect/tex.vim
, to make all .tex files loaded as one filetype?
Is there a way to create a group of filetypes in snipmate that share the same snippet?
@TroySigX This is exactly the sort of situation for which scope aliases were added (documented under :h SnipMate-options
). Basically:
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['foo'] = 'foo,bar'
The first line is just necessary to create the variable. The second line says "Whenever SnipMate loads a foo
file, load both foo
and bar
snippets".
For your situation, this would result in something like the following:
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['tex'] = 'tex,plaintex'
let g:snipMate.scope_aliases['plaintex'] = 'tex,plaintex'
These lines can go in your vimrc.
I'm going to close this as I think this sufficiently resolves the problem, but I'd be happy to answer more questions in this issue on this topic if you have them.
@TroySigX I'm sorry, I didn't see your most recent question until just now. If I understand it correctly, this can be done with scope aliases. Place all the snippets into a .snippets
file named however you want (but it should be something that is unlikely to be a filetype). For example, giantsub.snippets
. Then create the scope aliases:
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['tex'] = 'plaintex,tex,giantsub'
let g:snipMate.scope_aliases['plaintex'] = 'plaintex,tex,giantsub'
Thank you very much @ajzafar!
2 filetypes, tex and plaintex, sometimes used interchangeably, and I want to apply my latex snippets for both filetypes. And constantly having to copy between directories is very inconvenient. Any idea how to solve this?