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

Snippets #175

Closed
zyedidia opened this issue Jun 21, 2016 · 9 comments
Closed

Snippets #175

zyedidia opened this issue Jun 21, 2016 · 9 comments

Comments

@zyedidia
Copy link
Owner

zyedidia commented Jun 21, 2016

It would be nice to support snippets. The user would type a predefined pattern (defined for the current filetype), press a key, and it would expand into a large piece of code. This is meant for dealing with boilerplate. Here is an example of a Vim snippets plugin:

snippets

We can just use their predefined patterns from this repository.

Ref #174

@boombuler
Copy link
Contributor

@zyedidia if you are not working on this I would start implementing it...

@zyedidia
Copy link
Owner Author

zyedidia commented Sep 9, 2016

Sure. I recommend implementing it as a plugin because that feels more natural to me. I understand that the plugin system isn't so mature yet, so if you have any issues let me know.

What do you think of implementing it as a plugin vs in the core?

@boombuler
Copy link
Contributor

I think implementing it as plugin seems like a good idea but it might require some additions to core which could also benefit other plugins.

If you have a look at the screenshot you've postet there is some kind of dropdrown which I would implement in the core which then might get populated by different plugins. which could also be used for various autocomplete plugins (which make also more sense as plugin...)

@zyedidia
Copy link
Owner Author

zyedidia commented Sep 9, 2016

Yeah, I think the behavior from the screenshot is much more advanced than necessary. The dropdown menu is from Vim's autocompletion and the variable completion is not really necessary.

@boombuler
Copy link
Contributor

boombuler commented Sep 10, 2016

progress can be seen on my snippet branch

@boombuler
Copy link
Contributor

Hi again, I'm making some good progress though I'm not sure if the current way of input handling is the right choice. @zyedidia would you mind to have a look and tell me what you're thinking before I continue?

@zyedidia
Copy link
Owner Author

I'm not sure what you mean by "input handling" but I think it looks good. Just one note: the extension for snippets files should be .snippets not .snippet.

Great progress 👍 .

@boombuler
Copy link
Contributor

With "Input handling" I mean the last 2 changes with onBeforeTextEvent etc.
And I have some problem with selecting the next placeholder. But I guess thats nothing impossible :)

@boombuler boombuler mentioned this issue Sep 11, 2016
@zyedidia
Copy link
Owner Author

zyedidia commented Oct 6, 2016

This is now finished thanks to @boombuler! You can install the snippets plugin using the new plugin manager with plugin install snippets.

@zyedidia zyedidia closed this as completed Oct 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants