Getting smartparens wrapping to work in evil-visual-state

ivan ivan.brennan at gmail.com
Sun Nov 27 14:27:45 CET 2016


I've been migrating from Vim to Emacs in evil mode, and I'd like to use
smartparens. I know there's a port of surround.vim, but I've always found
surround.vim awkward to use, so I'd like to explore an alternative approach.

I particularly like smartparens' take on wrapping -- select a region and
type "(" to wrap it in parens. This seems especially nice in concert with
expand-region.

But in evil-visual-state, "(" is bound to evil-backward-sentence-begin. The
binding originates in evil-motion-state-map, which both normal and visual
states inherit from. I've tried a few ways to rebind "(" to
self-insert-command in order to let smartparens do its thing, but so far
nothing I've tried has worked:

(define-key evil-visual-state-map (kbd "(") 'self-insert-command)
(define-key evil-motion-state-map (kbd "(") 'self-insert-command)
(define-key evil-motion-state-map (kbd "(") nil)
(evil-define-key 'visual evil-visual-state-map (kbd "(")
'self-insert-command)

How can I properly configure this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ourproject.org/pipermail/implementations-list/attachments/20161127/07ea8ac2/attachment.html>


More information about the implementations-list mailing list