[vim/vim] Editable dot register (PR #19342)

7 views
Skip to first unread message

Shougo

unread,
Feb 6, 2026, 1:36:59 AM (4 days ago) Feb 6
to vim/vim, Subscribed

neovim/neovim#33030

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.


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

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

Commit Summary

File Changes

(5 files)

Patch Links:


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/19342@github.com>

Shougo

unread,
Feb 6, 2026, 1:47:52 AM (4 days ago) Feb 6
to vim/vim, Push

@Shougo pushed 1 commit.

  • 3ef51e2 Dot is not readonly register


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/9a5053180336c13596565e8ed09a5eea1f3c8845/after/3ef51e2b9b5d03dad31feaf61c05f2a6e39db77e@github.com>

Shougo

unread,
Feb 6, 2026, 1:55:33 AM (4 days ago) Feb 6
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3858396545@github.com>

Shougo

unread,
Feb 6, 2026, 2:45:13 AM (4 days ago) Feb 6
to vim/vim, Push

@Shougo pushed 1 commit.

  • 9c61754 Fix valid_yank_reg() check

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/3ef51e2b9b5d03dad31feaf61c05f2a6e39db77e/after/9c61754fddca29b221a260f09590bea0e02a9675@github.com>

Shougo

unread,
Feb 6, 2026, 2:47:55 AM (4 days ago) Feb 6
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3858593457@github.com>

Shougo

unread,
Feb 6, 2026, 2:48:43 AM (4 days ago) Feb 6
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3858600200@github.com>

zeertzjq

unread,
Feb 6, 2026, 2:50:57 AM (4 days ago) Feb 6
to vim/vim, Subscribed

@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.Message ID: <vim/vim/pull/19342/review/3761387802@github.com>

Shougo

unread,
Feb 6, 2026, 4:03:48 AM (4 days ago) Feb 6
to vim/vim, Push

@Shougo pushed 3 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/9c61754fddca29b221a260f09590bea0e02a9675/after/b7aa926bf0ed00f10382b36a05ab4f81e9b48497@github.com>

Shougo

unread,
Feb 6, 2026, 4:03:55 AM (4 days ago) Feb 6
to vim/vim, Subscribed

@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.Message ID: <vim/vim/pull/19342/review/3761670523@github.com>

Shougo

unread,
Feb 6, 2026, 4:04:49 AM (4 days ago) Feb 6
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3858932128@github.com>

Christian Brabandt

unread,
Feb 6, 2026, 5:32:36 AM (4 days ago) Feb 6
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3859520580@github.com>

mattn

unread,
Feb 6, 2026, 7:14:38 AM (4 days ago) Feb 6
to vim/vim, Subscribed
mattn left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3860090217@github.com>

Shougo

unread,
Feb 7, 2026, 2:39:21 AM (3 days ago) Feb 7
to vim/vim, Push

@Shougo pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/b7aa926bf0ed00f10382b36a05ab4f81e9b48497/after/197ef379877dc37c544ab25fd71b13f7c8bdbbf6@github.com>

Shougo

unread,
Feb 7, 2026, 2:42:10 AM (3 days ago) Feb 7
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3863881779@github.com>

Shougo

unread,
Feb 7, 2026, 2:43:19 AM (3 days ago) Feb 7
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3863882812@github.com>

Shougo

unread,
Feb 7, 2026, 3:11:14 AM (3 days ago) Feb 7
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3863918419@github.com>

Shougo

unread,
Feb 7, 2026, 3:27:35 AM (3 days ago) Feb 7
to vim/vim, Push

@Shougo pushed 1 commit.

  • 27774e3 Add skipRestoreRedobuff()

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/197ef379877dc37c544ab25fd71b13f7c8bdbbf6/after/27774e323f5109b7258756acabb13bb75ba25640@github.com>

Shougo

unread,
Feb 7, 2026, 3:28:27 AM (3 days ago) Feb 7
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3863948805@github.com>

Shougo

unread,
Feb 9, 2026, 5:42:13 AM (yesterday) Feb 9
to vim/vim, Push

@Shougo pushed 1 commit.

  • 8139384 Add skip_restore_redo_cnt

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19342/before/27774e323f5109b7258756acabb13bb75ba25640/after/8139384dd0eb6036c386ce03d214633d94f15a76@github.com>

Shougo

unread,
Feb 9, 2026, 5:42:27 AM (yesterday) Feb 9
to vim/vim, Subscribed
Shougo left a comment (vim/vim#19342)

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.Message ID: <vim/vim/pull/19342/c3870913100@github.com>

h_east

unread,
Feb 9, 2026, 11:26:01 PM (12 hours ago) Feb 9
to vim/vim, Subscribed
h-east left a comment (vim/vim#19342)
  • There's a CI error caused by you. (You're mixing C and C++ specifications.)
  • Is that the only documentation change you need?
    Don't you need to at least change :h quote_.?
  • And don't you need tests that actually use the updated . 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.Message ID: <vim/vim/pull/19342/c3875243229@github.com>

Reply all
Reply to author
Forward
0 new messages