如何使用 Ultisnip 获取降价代码片段以在 vim 中的数学中工作?

How do I get markdown snippets with Ultisnip to work within math in vim?

例如,我有这个自定义片段:

snippet frac "Fraction"
\frac{${1:numerator}}{${2:denominator}} [=11=]
endsnippet

在数学中,按 不会展开代码段。

$frac <- at this point the dropdown for snippets shows up, but pressing <tab> does nothing.

相关插件和设置:

Plug 'Valloric/YouCompleteMe'
Plug 'ervandew/supertab'
Plug 'vim-pandoc/vim-pandoc'
Plug 'vim-pandoc/vim-pandoc-syntax'
Plug 'vim-pandoc/vim-rmarkdown'
Plug 'junegunn/goyo.vim'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'ludovicchabant/vim-gutentags'

let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_filetype_blacklist = {}
let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:UltiSnipsExpandTrigger = "<tab>"
let g:UltiSnipsJumpForwardTrigger = "<tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
let g:UltiSnipsSnippetDirectories=["UltiSnips", "custom-snippets"]

在这种情况下,代码段不会展开,因为它前面有 $,中间没有任何空格。尝试将 i 添加到代码段的第一行:

snippet frac "Fraction" i
\frac{${1:numerator}}{${2:denominator}} [=10=]
endsnippet

相关::help UltiSnips-snippet-options

   i   In-word expansion - By default a snippet is expanded only if the tab
       trigger is the first word on the line or is preceded by one or more
       whitespace characters. A snippet with this option is expanded
       regardless of the preceding character. In other words, the snippet can
       be triggered in the middle of a word.