anzu icon indicating copy to clipboard operation
anzu copied to clipboard

Replace in visual selection

Open user471 opened this issue 8 years ago • 13 comments

Is it possible to use anzu in selected region? For example I have this line

foo foo foo

I press V to select the line and use anzu-replace-at-cursor-thing but it shows

No symbol at cursor!!

user471 avatar Apr 01 '16 09:04 user471

Is it possible to use anzu in selected region?

No.

Emacs replacement commands use region for limiting replacement range. Replace commands of anzu behaves same as them.

syohex avatar Apr 01 '16 09:04 syohex

I think I need to rephrase. Yes, I can use anzu in selected region. But anzu-replace-at-cursor-thing sometime doesn't detect an symbol at cursor. For example it works on first line but it doesn't work on second.

img

user471 avatar Apr 01 '16 11:04 user471

Thanks for information. I'll try to check.

syohex avatar Apr 02 '16 13:04 syohex

In evil-mode, cursor is moved to forward of region-end after calling execute-extended-command(M-x).

syohex avatar Apr 04 '16 03:04 syohex

Hmm, I cannot get original point before invoking command. How I get it ?

syohex avatar Apr 04 '16 03:04 syohex

It is retrieve from evil-visual-point.

syohex avatar Apr 04 '16 04:04 syohex

@user471 I have fixed #70. Could you check it ?

syohex avatar Apr 04 '16 04:04 syohex

On line

foo foo foo

when cursor is on the second foo and I press V and anzu-replace-at-cursor-thing, anzu highlights all three foo instead of just second and third. Also there is a weird cursor jumping to the next line.

user471 avatar Apr 04 '16 05:04 user471

when cursor is on the second foo and I press V and anzu-replace-at-cursor-thing, anzu highlights all three foo instead of just second and third.

In such case, region is from beginning of line to end of line so this behaviour is expected.

syohex avatar Apr 04 '16 05:04 syohex

Would it be possible to support this cursor position similar to normal cursor? untitled

user471 avatar Apr 04 '16 05:04 user471

On the other hand this cursor doesn't play well with multi line selection (selection should be reverted). So maybe it's not worth it.

user471 avatar Apr 04 '16 06:04 user471

Would it be possible to support this cursor position similar to normal cursor?

Yes. But I suppose few people expects such behaviour.

syohex avatar Apr 04 '16 09:04 syohex

As I'm just picking up maintenance on this package, I'm going to mark this with a "won't fix" based on syohex's last comment (few people would expect this behavior).

However I'll also leave the ticket open for a while in case there are strong objections. Please leave a comment and let me know!

gonewest818 avatar Mar 20 '20 22:03 gonewest818