From :help UltiSnips-adding-snippets
(section 4.1):
UltiSnips iterates over the snippet definition directories looking for
files with names of the following patterns: ft.snippets
,
ft_*.snippets
, or ft/*
, where "ft
" is the 'filetype' of the current
document and "*
" is a shell-like wildcard matching any string
including the empty string. The following table shows some typical
snippet filenames and their associated filetype.
snippet filename filetype ~
ruby.snippets ruby
perl.snippets perl
c.snippets c
c_my.snippets c
c/a c
c/b.snippets c
all.snippets *all
all/a.snippets *all
So, if your current buffer's filetype is vim
, you should only be seeing snippets from vim.snippets
(and an all.snippets
, if you had one).
There are a few reasons why UltiSnips would load snippets for multiple filetypes at the same time for a single buffer:
- UltiSnips supports Vim's dotted filetypes, so if your buffer's
filetype is set to
bash.sh
, UltiSnips will load both bash snippets
and sh snippets.
- Snippet files can also extend each other using the
extends ft1, ft2,
ft3
syntax. C++ snippet files usually start off with extends c
, so
cpp
files will load both c.snippets
, and cpp.snippets
.
- Bugs. If your buffer's filetype does not include both
vim
and sh
, and neither vim.snippets, nor sh.snippets extend the other (either directly, or indirectly through yet more filetypes), then it's quite possible you've found a bug.
Regarding listing all loaded files... I'm not sure if that's possible, but you might be able to get something similar. The description for the UltiSnips#SnippetsInCurrentScope
function says this (section 3.5.3 from above link):
This function simply returns a vim dictionary with the snippets whose
trigger matches the current word. If you need all snippets
information of current buffer, you can simply pass 1 (which means all)
as first argument of this function, and use a global variable
g:current_ulti_dict_info
to get the result
There's also a specific example of the latter usage further down the help page.