Skip to content

Conversation

@tuhdo
Copy link
Contributor

@tuhdo 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.

- 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
Copy link
Owner

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
Copy link
Contributor Author

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
Copy link
Owner

@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 that referenced this pull request Nov 29, 2015
d12frosted pushed 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants