[vim/vim] Make the '.' single-repeat command content available via the ',' and ';' registers (#6346)

19 views
Skip to first unread message

Christian Zangl

unread,
Jun 26, 2020, 3:19:20 PM6/26/20
to vim/vim, Subscribed

See #6299

Supports getreg() and setreg() for ',' and ';' - where ',' is the current and ';' the previous command.

The initial idea was taken from the patch by Ben Schmidt. I've updated it and added support for setreg().

Warning: this is my first patch for Vim!


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/6346

Commit Summary

  • Make the '.' single-repeat command content available via the ',' and ';' registers.

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Yegappan Lakshmanan

unread,
Jun 26, 2020, 3:34:23 PM6/26/20
to vim/vim, Subscribed

@yegappan commented on this pull request.

Can you add some tests for this change? You can take a look at the many test scripts available under the testdir directory for example. You can also look at the code coverage results to add additional tests.

Bram Moolenaar

unread,
Jun 26, 2020, 3:53:09 PM6/26/20
to vim/vim, Subscribed

Thanks for getting this started. Although having just the current and previous redo command will be sufficient for most cases, there might be a reason to keep more. Just like we keep nine deletes in registers 1 - 9.
Unfortunately we don't have ten register names for this. Any ideas?

Christian Zangl

unread,
Jun 26, 2020, 4:10:00 PM6/26/20
to vim/vim, Subscribed

In that case, how about making only the current command available in the register ,?

The history could be accessed via Vim Script, e.g. getrepeat(n).

Andy Massimino

unread,
Jun 27, 2020, 7:41:28 AM6/27/20
to vim/vim, Subscribed

Unfortunately, there is a problem with visual operations.. e.g., if you do v3ld then . deletes 3 characters but echo @, gives vd.

Would it make sense if @, and @; could work as expected? What about @=@,, @=@;? The former could be just an alias for . and previous . but the latter could not be handled since vd is not the same operation.

Christian Zangl

unread,
Jun 27, 2020, 2:59:09 PM6/27/20
to vim/vim, Subscribed

Can you add some tests for this change?

I will try once it's clear how the feature should be implemented.

Unfortunately, there is a problem with visual operations.. e.g., if you do v3ld then . deletes 3 characters but echo @, gives vd.

I'm not sure what is going on here since I am just using get_buffcont() that was already in Vim. The same function is IMHO used for recording where it works.

Andy Massimino

unread,
Jun 27, 2020, 9:05:35 PM6/27/20
to vim/vim, Subscribed

I'm not sure what is going on here since I am just using get_buffcont() that was already in Vim. The same function is IMHO used for recording where it works.

vim doesn't record the "redo buffer" like it does regular macros. For example, do qqv3l"adq, you'll get @q = v3l"ad but @, = "avd. Instead, it uses a custom format string which is roughly ["{register}, v for visual, some more operations]. vim has to do some translation- see the function start_redo(). When v is encountered, it re-enters the prior visual mode at the new cursor location.

Adam Stankiewicz

unread,
Jul 3, 2020, 10:30:02 AM7/3/20
to vim/vim, Subscribed

Maybe introduce autocmd that is called when singe-repeat is used? Then one can save history of commands by saving ; register

cvwillegen

unread,
Aug 9, 2023, 6:18:07 AM8/9/23
to vim/vim, Subscribed

Any progress on this PR?


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/6346/c1671054388@github.com>

Christian Brabandt

unread,
Nov 2, 2024, 12:30:29 PM11/2/24
to vim/vim, Subscribed

Closed #6346.


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/6346/issue_event/15082193197@github.com>

Christian Brabandt

unread,
Nov 2, 2024, 12:30:34 PM11/2/24
to vim/vim, Subscribed

I am closing this one, as it seems to have been stalled. If you ever make progress on this feature, please create a new PR.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/6346/c2453040384@github.com>

Reply all
Reply to author
Forward
0 new messages