I'm trying to set up an autocompletion/snippet workflow that's a bit complicated. This is stemming from needing a better workflow for latex. Right now I'm using coc.nvim and UltiSnippets but I am willing from changing from coc to LanguageClient-neovim if need be.What I want to happen is as follows.
In general, I want tab to switch between things or scroll like it usually does with autocomplete, and I want enter to select things. I also want snippets to be prioritized.
Tab
If there is an autocomplete window open, I always want it to scroll through that. If a snippet is being expanded I want tab to jump to the next insert spot. Pseudo code - followed by what I think it roughly translates to - below.
if (there is an autocompletion context)
scroll down to the next autocompletion option
elseif (this is in the middle of snippeting in select mode)
jump to the next snippet insert place
else
normal tab
endif
" --- roughly equivalent to ---
if pumvisible()
<c-n>
elseif (this is in the middle of snippeting in select mode)
idk
else
idk
endif
Enter
If there is a snippet that can be expanded, expand the snippet. Otherwise if the autocompletion window is up, select whatever is there. If nothing special is going on, just a normal enter.
if (snippet can be expanded)
(expand snippet)
elseif (there is an autocompletion context)
(select autocomplete option)
else
(normal enter)
endif
" --- roughly equivalent to ---
if !empty(UltiSnips#SnippetsInCurrentScope())
UltiSnips#ExpandSnippet()
elseif pumvisible()
<c-y>
else
<cr>
endif
I tried a lot of stuff with coc and ultisnips. I tried it with and without supertab. Supertab made it a lot better but it isn't quite what I want and some things, such as normal tabbing (sometimes) and jumping to the next snippet insert spot were broken.
Partial answers are welcome. @mods if this question is too specific or whatever, tell me how to break it up or make it better. The reason I ask is cause I figure it should be easy but I'm just missing something.
If there is some easy standard thing that I'm missing and its just like what I want but a little different, I'm open to it. If you think this is a dumb setup I'd love to learn why and explain my point of view.