expez / evil-smartparens

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

backspace key just deletes a single character when I mark a string using Ctrl-space in insert state #53

Closed c02y closed 5 years ago

c02y commented 5 years ago

I don't know this is the problem of spacemacs or evil-smartparens, I'll post this issue first.

When I'm in insert state in spacemacs, and use Ctrl-space to mark a string like vanilla emacs, and I'd like to delete this marked string, usually I just hit backspace, but backspace just delete a single character in spacemacs, and it's bound to sp-backward-delete-char.

So, how can I delete the string marked with Ctrl-space when I'm in insert state? (Please don't say that I SHOULD mark string in normal state.)

expez commented 5 years ago

Hi,evil-smartparens takes control over the backspace key to prevent people accidentally unbalancing the buffer. If you don't want it to do that, just rebind the backspace key to whatever other behavior you want in insert mode.

You might consider implementing this by adding a piece of after advice to the evil-sp--add-bindings function. That way you guarantee that your bindings always takes precedence.

You can read more about advice here if you're not already familiar with them.

If you think everyone else might want the same behavior then I'll happily accept a PR that sets up a binding for backspace that also checks if region is active.

Best of luck!