emacs-evil / evil-surround

you will be surrounded (surround.vim for evil, the extensible vi layer)
Other
627 stars 60 forks source link

Surround friendly text objects must be declared on global map #164

Closed iyefrat closed 4 years ago

iyefrat commented 4 years ago

evil-surround-(inner|outer)-overlay matches the inputted character against the global text object map. This means that in order to have minor-mode specific text objects that interact with evil-surround, they must be defined on the global keymap, where they might conflict with other mappings.

Would it be possible to add support for reading text objects from a local keymap? This seems very doable, and I'd be happy to make a PR.

ninrod commented 4 years ago

@itai33, since we have a decent test set now, feel free to do it.

Ideally, the PR should add some tests to verify this funcionality.

iyefrat commented 4 years ago

excellent! just to be sure, when you say tests, you mean things using ert in evil-surround-test.el right?

iyefrat commented 4 years ago

@ninrod in this line, you include as part of your test csw), however this leads to the error No such a pair found (which also causes the test to fail). In neovim using vim-surround, this does surround the word with parentheses as expected. Is the test wrong or is this a bug?

Edit: My apologies, the problem is somewhere in my config, this works as expected in vanilla emacs.

Edit2: well it seems that evil-surround-test.el fails also on vanilla emacs, does it work on your end?

ninrod commented 4 years ago

Yes. You should try using make test, as described in the readme, or make emacs. It uses a naked emacs with only the absolute minimum dependencies you need.

iyefrat commented 4 years ago

That works, thank you. I'll submit a PR as soon as I finish writing the added tests.

ninrod commented 4 years ago

PR #165 by @itai33 successfully implements the behaviour.