I have the following text: 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1. Yank the strings "Foo" 2. Make an rectangle block to select the first column "1" 3. Press "r" 4. Press "C-r " followed by `"' 5. I expect the text to become the following: Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar But it doesn't, the text get messed up. York
On Thu, Sep 22, 2011 at 05:16:48PM -0400, York Zhao wrote:
I have the following text:
1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar 1 Bar
1. Yank the strings "Foo" 2. Make an rectangle block to select the first column "1" 3. Press "r" 4. Press "C-r " followed by `"' 5. I expect the text to become the following:
Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar Foo Bar
I do not know why you expect this behavior. The "r" command replaces the selected characters by another character. In you example the first character typed is "C-r" so the result should be something like ^R Bar ^R Bar ^R Bar ^R Bar ^R Bar ^R Bar and this is indeed the result in both, evil and Vim (at least in my Vim). Frank
I do not know why you expect this behavior. The "r" command replaces the selected characters by another character. In you example the first character typed is "C-r" so the result should be something like
^R Bar ^R Bar ^R Bar ^R Bar ^R Bar ^R Bar
If you have tried the scenario I provided, you would have noticed that the result is not as what you thought either.
and this is indeed the result in both, evil and Vim (at least in my Vim).
What you said is what is working in Vim, not what is working currently in Evil, however, I think what is working in Evil is even better and more useful. I hope you are not going to follow Vim this time, and I believe Evil has done better than Vim in this matter and I don't think we have to always blindly follow Vim even when we know it is not good in the specific situation. If you guy's decide not to follow Vim here, than making "C-r" work in this situation will be even better. York
Am Fri, 23 Sep 2011 10:36:18 -0400 schrieb York Zhao <[email protected]>:
I do not know why you expect this behavior. The "r" command replaces the selected characters by another character. In you example the first character typed is "C-r" so the result should be something like
^R Bar ^R Bar ^R Bar ^R Bar ^R Bar ^R Bar
If you have tried the scenario I provided, you would have noticed that the result is not as what you thought either.
I *have* tried this scenario and the result is exactly what I wrote - at least on my Vim and my Emacs 23.2.1. Anyhow the behaviour you request is a non-trivial issue because it interferes with the fact that "r" expects a character and not a command. After pressing "r" and when waiting for that character evil is *not* in insert-state so *no* insert state binding is active. It is certainly possible to get the behavior you desire but it needs work. Furthermore the behavior in many situations has to be worked out: What should happen if more than one column is selected? Replace each single character by the yanked text (i.e. multiple copies of the yanked text are inserted per line, one per character) or should the whole line be replaced? What should happen if the yanked text is line-wise or even a block itself?
What you said is what is working in Vim, not what is working currently in Evil, however, I think what is working in Evil is even better and more useful. I hope you are not going to follow Vim this time, and I believe Evil has done better than Vim in this matter and I don't think we have to always blindly follow Vim even when we know it is not good in the specific situation.
If you guy's decide not to follow Vim here, than making "C-r" work in this situation will be even better.
I welcome any ideas to get evil better than vim, but I currently have no idea for a robust behavior of the feature you want. But feel free to provide one ... Frank
I *have* tried this scenario and the result is exactly what I wrote - at least on my Vim and my Emacs 23.2.1.
I just tried it with "make emacs" and it worked as what you said, so obviously something is wrong with my configuration, I apologize for that.
Anyhow the behaviour you request is a non-trivial issue because it interferes with the fact that "r" expects a character and not a command. After pressing "r" and when waiting for that character evil is *not* in insert-state so *no* insert state binding is active. It is certainly possible to get the behavior you desire but it needs work. Furthermore the behavior in many situations has to be worked out:
What should happen if more than one column is selected? Replace each single character by the yanked text (i.e. multiple copies of the yanked text are inserted per line, one per character) or should the whole line be replaced?
What should happen if the yanked text is line-wise or even a block itself?
Yes, it's not trivial at all and may not be worth the effort, especially when there is workaround: select block -> "d" -> select block -> "I" -> "C-r "" to achieve what I wanted.
What you said is what is working in Vim, not what is working currently in Evil, however, I think what is working in Evil is even better and more useful. I hope you are not going to follow Vim this time, and I believe Evil has done better than Vim in this matter and I don't think we have to always blindly follow Vim even when we know it is not good in the specific situation.
If you guy's decide not to follow Vim here, than making "C-r" work in this situation will be even better.
I welcome any ideas to get evil better than vim, but I currently have no idea for a robust behavior of the feature you want. But feel free to provide one ...
Since what is working on my system is different from that in standard Evil of course you have no idea about what I was saying. Sorry about that. York
On 2011-09-22 23:16 +0200, York Zhao wrote:
1. Yank the strings "Foo" 2. Make an rectangle block to select the first column "1" 3. Press "r" 4. Press "C-r " followed by `"'
FWIW, the following produces what you want in Vim and Evil alike: 1. Yank the string into the register "a". 2. Select the first column. 3. Press "c". 4. Paste from the register with "C-r a". (Since the change operation copies the original column into the " register, we have to use another register.) -- Vegard
FWIW, the following produces what you want in Vim and Evil alike:
1. Yank the string into the register "a". 2. Select the first column. 3. Press "c". 4. Paste from the register with "C-r a".
(Since the change operation copies the original column into the " register, we have to use another register.)
I had actually tried this before, but I didn't use the register, instead I used `"' in "C-r" and it didn't work. I thought using register and `"' should be the same because `"' is a register too. Because of your email I tried it again with `"' and still not work, I then followed exactly your steps and worked. I then tried it in Vim and got exactly the same results. But I really don't understand why regular register worked but `"' as register doesn't work. Thanks, York
participants (3)
-
Frank Fischer -
Vegard Øye -
York Zhao