Vimpulse: Vim's insert char below/above cursor

Štěpán Němec stepnem at gmail.com
Sun Feb 20 20:38:08 CET 2011


Vegard Øye <vegard_oye at hotmail.com> writes:

> On 2011-02-19 15:37, Sébastien Rocca-Serra wrote:
>
>> I just wrote a small function to emulate Vim’s i_CTRL_E and
>> i_CTRL_Y. Please feel free to use it, change the names, or not use
>> it. The code is here: http://gist.github.com/834957
>
> Thanks for your contribution. I'm forwarding this to the mailing list,
> as Štěpán Němec sent me some similar code recently, which also deals
> with tabs and control characters. It's added in commit 853ba91.
>
> I wonder about the prefix argument, though. Currently, it specifies
> the number of lines to move forward or backward, like in your
> implementation. Wouldn't it make better sense to specify the number of
> characters to copy? I don't see myself typing "C-3 C-e C-3 C-e" to
> copy text character by character from three lines ahead, but I might
> do "C-5 C-e" to get a chunk of characters at once. What do you think?

Well, that's what the code I sent you does. It copies PREFIX characters
from the first non-blank line above/below the current one. It certainly
makes more sense to me that way. Not that I actually use the prefix
argument -- I just lean on C-y/e until I copy as much as needed. ;-)

Maybe the most useful version would be to only provide a prefix argument
at the beginning to mean Nth non-blank line above/below and then use
that line for all subsequent C-y/es. Wouldn't be hard to do, I've never
felt that need, though.

  Štěpán



More information about the implementations-list mailing list