The mapping
cnoremap {lhs} <C-r>=&cedit<CR>:call UltiSnips#ExpandSnippet()<CR><C-c>
maps {lhs} to expand a (simple) snippet in the command line.
Here's what the {rhs} of the mapping does:
<C-r>=&cedit<CR> switch to the command line window (Typically evaluates to <C-f>)
:call UltiSnips#ExpandSnippet()<CR> expand the snippet
<C-c> switch back to the command line
An UltiSnips snippet cannot be expanded in the command line. However, the command line window, being a "standard" buffer, allows snippets to be expanded within.
For simple snippets with no placeholder texts, this mapping works as intended.
However, if a snippet contains multiple tabstops, the user is unable to jump beyond the first tabstop. Also, if a tabstop contains placeholder text, it is not overwritten upon further typing. One possible explanation is that after <C-c>
is pressed, the command line window is "forgotten", and along with it, the tabstops' locations.
A workaround is to remain in the command line window, instead of going back to the command line. (ie., remove <C-c>
in the mapping above). Then, placeholder texts are correctly overwritten upon typing, and the user can jump between tabstops as desired.