expez / evil-smartparens

Evil integration for Smartparens
GNU General Public License v3.0
134 stars 17 forks source link

evil-smartparens can't handle multi-character ruby pairs like "def" "end". #39

Closed AlexChalk closed 6 years ago

AlexChalk commented 7 years ago

When I try to delete code like

def echo(value)
  puts value
end

with 3dd, only the first two characters of def are deleted, instead of the whole three lines. If I use 3dd again, I'm still left with the final d of end. The behaviour is the same when yanking code.

I don't really care about smartparens handling these sorts of pairs, so I tried just disabling them with eval-after-load statements like

(eval-after-load 'smartparens-ruby (lambda () (sp-local-pair 'ruby-mode "def" nil :actions :rem)))

This disables auto-insertion of the pairs, but I still get the same problem when trying to delete and yank code.

I'd be grateful for a solution that either fixes evil-smartparens's handling of these pairs, or just allows me to fully disable them.

expez commented 7 years ago

Hi

That is unfortunate. I'll dig into this when I have some time, but it might be a while.

If this is really bugging you I'd appreciate the help.

Most likely this is a problem with sp-region-ok-p which evil-sp uses to evaluate whether an operation is OK or not.

IIRC that function doesn't work very well with certain pairs, but fixing it wasn't a good idea either because it would slow down the general case to such a degree that this package would be unusable.

AlexChalk commented 7 years ago

For now I've added the line I mentioned in my evil-smartparens config too—it just disables the pairs and stops the annoying yank/delete behaviour. I don't really see the need for them to be honest—auto-indentation already stops me from forgetting to close a code block.

I'm pretty new to this (actually about to start coding bootcamp tomorrow!) so I'm afraid I can't be more help at present. Looking forward to digging deeper into emacs once I'm a proper dev.

expez commented 6 years ago

I can't reproduce this anymore. Likely solved by changes to smartparens and better evil integration.

RX14 commented 6 years ago

This is still happening for me. Exactly the same bugreport as the OP.