evil-smartparens
evil-smartparens copied to clipboard
026d4a3 needs reworking
https://github.com/expez/evil-smartparens/commit/026d4a3cfce415a4dfae1457f871b385386e61d3 needs to be more carefully thought out - it only partially fixed the issue. More specifically, as soon as evil-smartparens is loaded at all (in any buffer), the DEL
key is rebound for every buffer that has evil-smartparens-mode
on (since the binding uses the global variable evil-smartparens-mode-map
), regardless of whether smartparens-strict-mode
is on in that buffer.
I've found a temporary work around thorugh (make-variable-buffer-local 'evil-smartparens-mode-map)
, but that's kind of hackish and doesn't feel like a final solution. One option could be to go the general-predicate-dispatch
way and bind DEL to something like (macro-expansion of general-predicate-dispatch
, could probably just use an if
statement for our purposes):
(evil-define-key 'insert evil-smartparens-mode-map
(kbd "DEL") '(menu-item "" nil :filter
(lambda
(&optional _)
(cond
(smartparens-strict-mode 'sp-backward-delete-char)
(t nil)))))
Which essentially actively checks if smartparens-strict-mode is enabled and does nothing if not.
We should probably introduce evil-smartparens-local-mode-map
to solve this.
@expez could you elaborate on what you mean by that a bit? Are you saying evil-smartparens-mode-map
basically does have to be local cause of this, and it should be called evil-smartparens-local-mode-map
?
evil has to maps for everything e.g. an evil-insert-state-map
and an evil-insert-state-local-map
where the local map is used for overriding, on a per-buffer basis, the global key map.
I haven't done any digging yet, but I think this could probably be solved by having two maps, like evil has.