evil-surround icon indicating copy to clipboard operation
evil-surround copied to clipboard

use evil's facilities to correct key translations

Open favetelinguis opened this issue 9 years ago • 16 comments

I have the following keybindings in init.el (define-key key-translation-map (kbd "[") (kbd "(")) (define-key key-translation-map (kbd "]") (kbd "[")) (define-key key-translation-map (kbd "(") (kbd "{"))

However evil/surround will ignore them and use the regular keys, i i would like to wrap a world with () it becomes [] with evil/surround. Is there a possible fix for this?

Also after watching this https://www.youtube.com/watch?v=5HF4jSyPpvs not much of what he shows work with this plugin, am i doing it wrong for example the dst cat does not work?

favetelinguis avatar Sep 10 '14 05:09 favetelinguis

I also have an issue trying to si{ when using this translation-key-map (define-key key-translation-map (kbd "M-(") (kbd "{")) (to make shift-alt-8 work like you expect on a norwegian keyboard)

torgeir avatar Dec 06 '15 19:12 torgeir

I'm still looking for a solution to this. Here's a gif showing the issue at hand:

evil-surround-issue mov

This is with the following key-translation-maps in play

(define-key key-translation-map (kbd "M-(") (kbd "{"))
(define-key key-translation-map (kbd "M-)") (kbd "}"))

Running e.g. si( when a key-tanslation-map is in place for ( results in Wrong type argument: characterp, 134217769.

The si{ case is possibly another issue, as I have no translation for { (which is shift meta 8 on a norwegian os x keyboard)

torgeir avatar May 08 '16 20:05 torgeir

this issue may actually be resolved with my (already merged) pull request https://github.com/timcharper/evil-surround/pull/81

@favetelinguis @torgeir any chance you can try it out?

wbolster avatar Nov 04 '16 16:11 wbolster

i am using evil-swap-keys and can confirm that things like ds( work fine for me without pressing the shift key at all, since 9 and ( are swapped by that package.

wbolster avatar Nov 04 '16 16:11 wbolster

this issue may actually be resolved with my (already merged) pull request #81

Indeed, works like a charm! All my tests from above seems to be working perfectly.

torgeir avatar Nov 05 '16 10:11 torgeir

awesome.

@timcharper this issue can be closed. (btw feel free to make me a collaborator so that i can close and tag issues.)

wbolster avatar Nov 05 '16 21:11 wbolster

Oh, thank you!

timcharper avatar Nov 05 '16 22:11 timcharper

I believe this has resurfaced again? Seems the changes of #81 is no longer in master.

torgeir avatar Jul 18 '17 19:07 torgeir

@torgeir you are right. :(

https://github.com/emacs-evil/evil-surround/issues/84#issuecomment-273868085

wbolster avatar Jul 18 '17 19:07 wbolster

Ah, missed that.

torgeir avatar Jul 18 '17 20:07 torgeir

It was unfortunate that #81 contained a regression that was actually a big deal because it broke the . operator for evil-surround. The . operator is critical for this plugin.

But maybe we can ressurect #81 with the hack contained in #115. This would bring the benefits of #81, but without also bringing in #24 as a regression.

ninrod avatar Jul 18 '17 21:07 ninrod

The regression caused by #81 is actually caused by a bug in evil (see https://github.com/emacs-evil/evil/pull/865 for some context), and #115 is actually just a poor man's #81. #81 should be un-reverted once the root bug in evil is solved. But I haven't had time to look into it more and figure out a solution that doesn't break other things, so I'm not sure when that will be.

willghatch avatar Aug 01 '17 22:08 willghatch

Any updates on this one?

torgeir avatar Nov 04 '17 20:11 torgeir

@torgeir https://github.com/emacs-evil/evil/pull/865 is stalled.

ninrod avatar Nov 04 '17 23:11 ninrod

I haven't made progress on the evil bug. Too busy in school and working on rash. Sorry about that.

willghatch avatar Nov 05 '17 16:11 willghatch

Reopened because we are waiting for https://github.com/emacs-evil/evil/pull/865 to be merged into master in evil. See pull https://github.com/emacs-evil/evil-surround/pull/115 by @willghatch.

ninrod avatar Dec 10 '17 18:12 ninrod