vim-vsnip icon indicating copy to clipboard operation
vim-vsnip copied to clipboard

Question: is it possible to make snippets work only on beginning of the line?

Open gegoune opened this issue 5 years ago • 3 comments

Ultisnips supports it. I am not sure if such option is part of VSCode snippets' format (couldn't find anything on that in documentation linked in this repo's README) or whether vim-vsnip does/could do itty itself.

Thanks!

gegoune avatar Jan 03 '21 16:01 gegoune

Currently, No.

It maybe related to https://github.com/hrsh7th/vim-vsnip/issues/136

hrsh7th avatar Jan 03 '21 17:01 hrsh7th

No, you probably can get the desired behaviour by implementing a custom vim function and then call it through the VIM syntax, e.g. ${VIM: (col('.') == 1) ? 'snippet' : 'prefix'}

It always expands, but if not at the beginning of the line it behaves like a noop. It is hacky and does not support tabstops or similar behaviours though. :D

ghyatzo avatar Jan 03 '21 18:01 ghyatzo

Don't like the hacky idea, but thanks! Seems like line_pattern from #136 might do that? Will wait for it. Thanks for great plugin!

gegoune avatar Jan 03 '21 20:01 gegoune