Background
I'm using UltiSnips in conjunction with some autocomplete plugins. I have this line controlling the behavior of enter
inoremap <expr> <cr>
\ !empty(UltiSnips#SnippetsInCurrentScope()) ?
\ "\<C-R>=UltiSnips#ExpandSnippet()\<cr>" :
\ pumvisible() ? "\<c-y>" : "\<cr>"
The idea is to check for snippets (and expand if necessary) then check for autocomplete suggestions (and select that if it is available) and if nothing is going on, use enter.
The Problem
When I press enter on a blank line I don't get a new line. I figured out that what's happening is UltiSnips#SnippetsInCurrentScope()
returns a bunch of my snippets when I'm at the beginning of a blank line.
The idea of using UltiSnips#SnippetsInCurrentScope()
is from the UltiSnips docs (part 6, the FAQ) as a stand in for an "IsExpandable" function.
Question
Is there another function that captures the spirit of what I want better? If not what is the best way to achieve what I want (just a case that checks if the lines empty?)?
Thanks in advance