Improve yasnippet #1000

Closed
wants to merge 1 commit into
from

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.
0379b7a
@syl20bnr syl20bnr added the Yasnippet label Apr 2, 2015
@syl20bnr
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
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
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 StreakyCobra added a commit to StreakyCobra/spacemacs that referenced this pull request Nov 28, 2015
@StreakyCobra StreakyCobra Add an alternative solution for HELM #1000 in FAQ
Close #3853
7a31b06
@d12frosted d12frosted added a commit to d12frosted/spacemacs that referenced this pull request Nov 30, 2015
@StreakyCobra @d12frosted StreakyCobra + d12frosted Add an alternative solution for HELM #1000 in FAQ
Close #3853
d585d21
@d1egoaz d1egoaz pushed a commit to d1egoaz/spacemacs that referenced this pull request Feb 6, 2016
@StreakyCobra @diego-alvarez-hs StreakyCobra + diego-alvarez-hs Add an alternative solution for HELM #1000 in FAQ
Close #3853
2ad8abf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment