3

I am fairly new to customizing my emacs, so please be gentle. I did try to find a solution for this, but all I found was a page on git where someone asked a similar question but (as far as I can tell) never received an answer.

I have both smartparens and web-mode installed and am trying to work in .html.erb files.

The issue I am having is that whenever I type <%space I end up with <% %>> (notice the extra angular bracket).

Does anyone have any suggestions for how to deal with this, and how I would go about it? I don't really want to disable either of the packages.

1

You can turn off auto pairing for web mode and enable pairing for < & % in smartparens.

(require 'smartparens)
(sp-pair "%" "%" :wrap "C-%")
(sp-pair "<" ">" :wrap "C->")

(require 'web-mode)
(setq web-mode-enable-auto-pairing nil)

Now when you press <%space you will get <% %> with both modes enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.