vim 8, UltiSnips and coc-ultisnips: `${VISUAL}` does nothing
Asked Answered
P

1

8

Using vim 8, Ultisnips, and coc-ultisnips.

Consider this snippet:

snippet cdeg "Add console.debug({})"
console.debug(${0:${VISUAL:value}})
endsnippet

I would expect it to expand cdeg to console.debug(value).

The problem is if I have that buffer:

hello

Then visual select hello, press C to replace it with cdeg and then expand. I would expect the buffer to look like that:

console.debug(hello)

But instead, I get

console.debug(value)

So it would seem ${VISUAL} has no effect with coc-ultisnips. Any idea what is going on, and how to have coc-ultisnips behave like UltiSnips regarding ${VISUAL}?

Privilege answered 21/5, 2020 at 10:42 Comment(0)
P
4

It could be that I was using it wrong. In UltiSnips, you have to visual select, then press , then your snippet, then again. Only then do you get your visual selection inserted.

I don't know if this works with coc-ultisnips, because I have switched back to YouCompleteMe + UltiSnips and Supertab: YCM provides better completion results for TypeScript and works fine with UltiSnips.

This is the ticket to using Tab for YCM and UltiSnips together: https://mcmap.net/q/159208/-ultisnips-and-youcompleteme

Privilege answered 25/5, 2020 at 7:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.