Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gegoune opened this issue Jan 3, 2021 · 3 comments
Labels
duplicate This issue or pull request already exists feature-request

Comments

@gegoune
Copy link

gegoune commented Jan 3, 2021

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!

@hrsh7th
Copy link
Owner

hrsh7th commented Jan 3, 2021

Currently, No.

It maybe related to #136

@ghyatzo
Copy link

ghyatzo commented Jan 3, 2021

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

@gegoune
Copy link
Author

gegoune commented Jan 3, 2021

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!

@hrsh7th hrsh7th added duplicate This issue or pull request already exists feature-request labels Jan 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature-request
Projects
None yet
Development

No branches or pull requests

3 participants