Current dot register is not editable.
https://github.com/tpope/vim-repeat plugin already exists. But when using this plugin, users must install repeat.vim and there are side effects such as changing the mappings to custom ones. Therefore, I adopted an approach of modifying the core functionality to make the dot register changeable from scripts.
https://github.com/vim/vim/pull/19342
(5 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@Shougo pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Oh, I have found the bug.
let @. += 'baz' will fail. I will fix it later.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The above bug has been fixed, but there are the following issues:
Issue 1: Even when the completion plugin overwrites the . register, it seems to be restored somehow. The timing is unclear.
Issue 2: The overwritten dot register value is not written to the buffer. Only the internal display changes. As a countermeasure, I'm manipulating the Redo buffer, but it doesn't seem to be taking effect.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I have changed it to the draft. Because it does not work well. The help is welcome.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@zeertzjq commented on this pull request.
In src/edit.c:
> @@ -2670,6 +2670,48 @@ set_last_insert(int c)
last_insert_skip = 0;
}
+/*
+ * Set the last inserted text to str.
+ */
+ void
+set_last_insert_str(char_u *str)
+{
+ char_u *s;
+ char_u *p;
+ int c;
+ size_t len = str ? STRLEN(str) : 0;
+
+ vim_free(last_insert.string);
+ last_insert.string = alloc(len * MB_MAXBYTES + 5);
⬇️ Suggested change
- last_insert.string = alloc(len * MB_MAXBYTES + 5); + last_insert.string = alloc(len * 3 + 5);
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
@Shougo pushed 3 commits.
You are receiving this because you are subscribed to this thread.![]()
@Shougo commented on this pull request.
In src/edit.c:
> @@ -2670,6 +2670,48 @@ set_last_insert(int c)
last_insert_skip = 0;
}
+/*
+ * Set the last inserted text to str.
+ */
+ void
+set_last_insert_str(char_u *str)
+{
+ char_u *s;
+ char_u *p;
+ int c;
+ size_t len = str ? STRLEN(str) : 0;
+
+ vim_free(last_insert.string);
+ last_insert.string = alloc(len * MB_MAXBYTES + 5);
Thanks.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
Dot repeat works by stuffReadbuff(). But it executes keys instantly...
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
related: #6299 , #6346 https://groups.google.com/g/vim_dev/c/TIH6wsD4Qo4/m/msUMWHnWt3oJ
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Probably this works well.
https://gist.github.com/mattn/5989cc3cf2edf47a25fa977a9cabc8a9
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Usage: call setreg('.', "ahoge\<ESC>") from command line.
Thanks. I have included the patch. It works from command line.
But one problem exists. If plugin changes dot register, dot register changes seems restored.
As it stands, it's difficult to handle the dot register from plugins, so I'll keep this as WIP for now.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
related: #6299 , #6346 https://groups.google.com/g/vim_dev/c/TIH6wsD4Qo4/m/msUMWHnWt3oJ
Thank you for the information. I have not found them.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I get it.
/* * Restore redobuff and old_redobuff from save_redobuff and save_old_redobuff. * Used after executing autocommands and user functions. */ void restoreRedobuff(save_redo_T *save_redo) { free_buff(&redobuff); redobuff = save_redo->sr_redobuff; free_buff(&old_redobuff); old_redobuff = save_redo->sr_old_redobuff; }
It restores dot register changes.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I have added skipRestoreRedobuff(). But it does not work well. The dot register is restored.
It is hard. The help is welcome.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I have added skipRestoreRedobuff(). But it does not work well. The dot register is restored.
It is hard. The help is welcome.
Fixed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
:h quote_.?. register?You seem to be doing things haphazardly every time.
As I've said many times before, you should take the time to do a self-review phase.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()