1

Re: Backwards range warning

Is it possible to kill this?

---------------------------
ViEmu
---------------------------
Backwards range given, swap?
---------------------------
Yes   No   
---------------------------


I've never seen it in Vim (unless I disabled it a very long time ago) and it seems rather.. random.

thanks,
scott

2

Re: Backwards range warning

Ah, actually I just checked more closely in Vim. I'd never typed a range in for a :s before with line numbers.

Specifically, when the range comes from using Visual mode (linewise or not), Vim does not prompt and automatically swaps them. So, would that be possible?

thanks,
scott

3

Re: Backwards range warning

Hi Scott,

I checked it myself too - you're right, vim has some special case to detect the case with visual mode. I will add it to ViEmu too - although I'll have to research exactly what is special cased out, as it isn't obvious (the :'<,'> range is just a regular mark-driven range).

I actually implemented the behavior because I saw it in vim while analyzing range behavior in detail for ex commands while first implementing ex support in ViEmu. I was pretty amazed to find it, as I had never stumbled into it while using vim regularly. But I thought I should just try to emulate it faithfully smile

Regards,

  Jon

4

Re: Backwards range warning

Hi, thanks

Yes, it looks like it's special for '<,'> AFAICT. Changing either the beginning or the end to either a line number or a different mark causes the warning to appear. Even changing to '>,'< will cause it to happen.

To be honest, I don't really ever want to see that warning personally, so if emulating this vim special case seems too arbitrary, adding a _viemurc option to just always autoswap would be just as good from my point of view.

thanks,
scott

5

Re: Backwards range warning

Thanks Scott for looking into the behavior. I'll most probably take your advice and implement a :set [no]autoswap, default to false, which probably makes the most sense.