Re: Vimpulse: Vim's insert char below/above cursor
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? -- Vegard
Oh, nice! I think you're right about the prefix argument, it's more usefull if it specifies the number of chars to copy (although I almost never use emacs' prefix arguments in insert mode). And the code of commit 853ba91 is more complete than my naive function (my code does strange things to tabs and control chars). Thanks again for Vimpulse. Cheers! Sébastien. 2011/2/20 Vegard Øye <[email protected]>:
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?
-- Vegard
Vegard Øye <[email protected]> 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
On 2011-02-20 20:38, Štěpán Němec wrote:
Vegard Øye <[email protected]> writes:
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.
Well, that's what the code I sent you does. ... Not that I actually use the prefix argument -- I just lean on C-y/e until I copy as much as needed. ;-)
Yeah, same. My point is rather moot ...
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.
Splendid idea! Thanks. Added in commit 54939d3. -- Vegard
participants (3)
-
Sébastien RoccaSerra -
Vegard Øye -
Štěpán Němec