Skip to content

Add dot repeat, safer undo, leader passthrough, and V selection#22

Open
hamidi-dev wants to merge 2 commits into
oribarilan:mainfrom
hamidi-dev:main
Open

Add dot repeat, safer undo, leader passthrough, and V selection#22
hamidi-dev wants to merge 2 commits into
oribarilan:mainfrom
hamidi-dev:main

Conversation

@hamidi-dev

@hamidi-dev hamidi-dev commented Jun 5, 2026

Copy link
Copy Markdown

Summary

  • Add normal-mode . repeat for command-based changes like dw, dd, x, and r{char}
  • Store vim change undo snapshots on a stack so repeated/count-based changes can be undone cleanly
  • Pass through OpenCode leader sequences in normal/visual mode, including configured leaders and Tab
  • Add V to select the current line and enter visual mode

Fixed

  • dw.. now repeats the delete-word change
  • u after dw.. walks back each repeated delete
  • 3dw now restores in one undo step
  • OpenCode leader bindings like <leader>e, <leader>l, and <leader>n are no longer swallowed by vimcode

Testing

  • bun test
  • bunx biome ci --error-on-warnings .

@hamidi-dev hamidi-dev marked this pull request as draft June 5, 2026 11:58
@hamidi-dev hamidi-dev changed the title fix: add dot repeat and prefix passthrough Add dot repeat, safer undo, leader passthrough, and V selection Jun 5, 2026
@hamidi-dev hamidi-dev marked this pull request as ready for review June 5, 2026 17:13
@oribarilan

Copy link
Copy Markdown
Owner

hey @hamidi-dev thx for the contribution. I prefer each PR to address a single specific issue, to allow easy rollback and troubleshooting. If possible, please split and send whatever you want out of this, and I will review and approve. Thanks!

@samuelmasuy

samuelmasuy commented Jun 10, 2026

Copy link
Copy Markdown

I'm really looking forward for "Pass through OpenCode leader" feature/fix. If I can help, let me know. Right now, it's akin to tmux prefix would not work in vim normal mode.

@oribarilan

Copy link
Copy Markdown
Owner

@samuelmasuy it is already supported a few versions back :) please see
#21

LMK if you like it or find something missing please (you can reuse issue 21 or open a new one)

@hamidi-dev

Copy link
Copy Markdown
Author

@oribarilan @samuelmasuy sorry i haven't gotten the time yet to address @oribarilan requests.
if the prefix issue is solved, thats great. i will work on the other topics of my PR.
or do you have an issue @samuelmasuy with prefix?
my original issue was using TAB as prefix.
I would have to test the v0.11.0 and see if that solves the TAB as prefix issue.

@samuelmasuy

samuelmasuy commented Jun 10, 2026

Copy link
Copy Markdown

@samuelmasuy it is already supported a few versions back :) please see #21

LMK if you like it or find something missing please (you can reuse issue 21 or open a new one)

I should have been more precise: this is not working for me, unless I configured something incorrectly.
My leader in opencode is <C-x>, and I have the plugin configured like this:

[
  "vimcode@git+https://github.com/oribarilan/vimcode.git#v0.13.0",
  {
    "modeToast": false,
    "startMode": "normal",
    "leader": "C-x",
  },
]

When I’m in normal mode and press C-x-m (to list models), the m gets swallowed.
On this branch, though, the leader works from any mode, which is how I expected it to behave.

@oribarilan

Copy link
Copy Markdown
Owner

@samuelmasuy vimcode doesn't require you to configure it, it uses the leader key you already have configured.
It wasn't documented well so I added this section, you can read it and see how it goes now :)

https://github.com/oribarilan/vimcode#leader-key

@samuelmasuy

samuelmasuy commented Jun 12, 2026

Copy link
Copy Markdown

@samuelmasuy vimcode doesn't require you to configure it, it uses the leader key you already have configured. It wasn't documented well so I added this section, you can read it and see how it goes now :)

https://github.com/oribarilan/vimcode#leader-key

I tried that too, here is a simple tui.json that reproduces for me:

{
  "$schema": "https://opencode.ai/tui.json",
  "keybinds": {
    "leader": "ctrl+x"
  },
  "plugin": [
    [
      "vimcode@git+https://github.com/oribarilan/vimcode.git#v0.13.0",
      {
        "modeToast": false,
        "startMode": "normal"
      }
    ]
  ]
}

<ctrl+x>m in normal mode does not popup the model selection. Note that not specifying any keybinds ALSO reproduces.

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.

3 participants