Make the '.' single-repeat command content available via the ',' and ';' registers by laktak · Pull Request #6346 · vim/vim · GitHub
Skip to content

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

Closed
laktak wants to merge 1 commit into
vim:masterfrom
laktak:savedot
Closed

Make the '.' single-repeat command content available via the ',' and ';' registers#6346
laktak wants to merge 1 commit into
vim:masterfrom
laktak:savedot

Conversation

@laktak

@laktak laktak commented Jun 26, 2020

Copy link
Copy Markdown

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!

…';' registers.

Supports getreg() and setreg() for ',' and ';'.

The initial idea was taken from the patch by [Ben Schmidt](https://groups.google.com/forum/#!msg/vim_dev/TIH6wsD4Qo4/msUMWHnWt3oJ). I've updated it and added support for setreg().

Warning: this is my first patch for Vim!
@laktak laktak mentioned this pull request Jun 26, 2020

@yegappan yegappan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@brammool

Copy link
Copy Markdown
Contributor

@laktak

laktak commented Jun 26, 2020

Copy link
Copy Markdown
Author

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).

@andymass

Copy link
Copy Markdown

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.

@laktak

laktak commented Jun 27, 2020

Copy link
Copy Markdown
Author

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.

@andymass

Copy link
Copy Markdown

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.

@sheerun

sheerun commented Jul 3, 2020

Copy link
Copy Markdown

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

@cvwillegen

Copy link
Copy Markdown
Contributor

Any progress on this PR?

@yegappan yegappan added this to the backlog milestone Aug 14, 2023
@chrisbra

chrisbra commented Nov 2, 2024

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants