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

Improve yasnippet #1000

Closed
wants to merge 1 commit into
base: develop
from

Conversation

Projects
None yet
2 participants
@tuhdo
Contributor

tuhdo commented Mar 31, 2015

  • Allow a snippet to wrap around a selected region when expanded: A user
    can select a region, press 'C-x C-x' to go to the original mark and
    run yas-expand to wrap the selected region in expanded snippet.
  • Reindent spacemacs/load-yasnipppet.
  • Allow hippie-expand to expand snippets as well. May replace TAB in
    the future.
Tu Do
Improve yasnippet
- Allow a snippet to wrap around a selected region when expanded: A user
  can select a region, press 'C-x C-x' to go to the original mark and
  run `yas-expand` to wrap the selected region in expanded snippet.

- Allow `hippie-expand` to expand snippets as well. May replace TAB in
  the future.

@syl20bnr syl20bnr added the Yasnippet label Apr 2, 2015

@syl20bnr

This comment has been minimized.

Owner

syl20bnr commented Apr 21, 2015

I finally merged it but I don't understand the wrapping feature, can you do a GIF to show it in action ? :-)

Anyway thank you !
Cherry-picked into develop branch, you can safely delete your branch.

@syl20bnr syl20bnr closed this Apr 21, 2015

@tuhdo

This comment has been minimized.

Contributor

tuhdo commented Apr 21, 2015

@syl20bnr Here your gif is:

yas-wrap-region-demo

To try it:

  • Type any snippet keyword before a region you are going to expand.
  • Set mark with C-SPC C-SPC.
  • Select a region.
  • Go back to the mark earlier with C-x C-x.
  • Press TAB.

Now the expanded snippet wraps around the region, i.e. a for loop wraps the selected code region in the demo.

@syl20bnr

This comment has been minimized.

Owner

syl20bnr commented Apr 24, 2015

@tuhdo That's super cool, thank you ! 👍
Funny thing: to my knowledge it is impossible to do in visual state, but this could be automated with a single key binding I suppose.

StreakyCobra added a commit to StreakyCobra/spacemacs that referenced this pull request Nov 28, 2015

StreakyCobra added a commit that referenced this pull request Nov 29, 2015

d12frosted added a commit to d12frosted/spacemacs that referenced this pull request Nov 30, 2015

d1egoaz pushed a commit to d1egoaz/spacemacs that referenced this pull request Feb 6, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment