reddit / emacs

[Noob] Question about Evil Mode functionality

uralgunners · 2022-03-17 16:20
Emacs Noob here, how can i change text inside bracket, curly bracket, square bracket and angle like vim in emacs mode using c i motion? I can change only if my cursor is under {, ( and <. Everything except those symbol works as expected. Error i got is "evil-motion-range: No surrounding delimiters found"Sorry but English is not my first language. Thank you guys! https://reddit.com/link/tgdxqf/video/qul9yfw0zyn81/player
sylvain_soliman · 2022-03-17 16:46
I'm not sure but I think most of the answer is explained there: https://github.com/noctuid/targets.el#additions-to-evils-functionality
[deleted] · 2022-03-17 16:48
[deleted]
uralgunners · 2022-03-17 16:48
Thank you! I'll check out this☺
TelcDunedain · 2022-03-17 18:45
Evil works just like vim - You MUST be <inside> the delimited block. So ci<foo inside the <> will do as you expect. It seems like from your keycast you were expecting something else? One of the examples seemed liked a bug... https://github.com/emacs-evil/evil-surround Is something you should probably add, its a port of the vim-surround from Tim Pope. It is designed to help you change the delimiters themselves to something else.
nv-elisp · 2022-03-17 20:59
Evil's behavior is slightly different than n/vim's in this regard. See previous evil-mode issues: https://github.com/emacs-evil/evil/issues?q=is%3Aissue+inner-double-quote
nv-elisp · 2022-03-17 21:04
> Evil works just like vim I've been able to confirm the difference in behavior. In (n)vim, if you are at the beginning of the following line (| indicating the cursor): |beginning [inner-bracket] and type `ci[`, the text between the brackets will be changed (deleted and and the user is left in insert state). In evil mode, under the same conditions, the user-error "No surrounding delimiters found" is raised. Note this is not the case for all text objects. e.g. qoutes and double quotes work the same as in Vim. It's likely due to the way Evil relies on Emac's syntax tables to parse delimiters in the case of brackets and curly braces.
uralgunners · 2022-03-18 00:36
So is it supposed to behave like that? Or is it a bug? If it is, then there's any fix or workaround for this?
uralgunners · 2022-03-18 00:46
>Evil works just like vim - >You MUST be <inside> the delimited block. So ci<foo inside the <> will do as you expect. In vim, i could do this from anywhere in line before opening <whatever> like (, <, { and [. >It seems like from your keycast you were expecting something else? One of the examples seemed liked a bug... Can you specify which one? >https://github.com/emacs-evil/evil-surround >Is something you should probably add, its a port of the vim-surround from Tim Pope. It is designed to help you change the delimiters themselves to something else. I added this package in my emacs. It's a great package and also works as expected. Thank you! And sorry if i'm not explaining correctly.
uralgunners · 2022-03-18 00:50
Ok! Thank you for this!