Add dot repeat, safer undo, leader passthrough, and V selection#22
Add dot repeat, safer undo, leader passthrough, and V selection#22hamidi-dev wants to merge 2 commits into
Conversation
|
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! |
|
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 |
|
@samuelmasuy it is already supported a few versions back :) please see LMK if you like it or find something missing please (you can reuse issue 21 or open a new one) |
|
@oribarilan @samuelmasuy sorry i haven't gotten the time yet to address @oribarilan requests. |
I should have been more precise: this is not working for me, unless I configured something incorrectly. [
"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 |
|
@samuelmasuy vimcode doesn't require you to configure it, it uses the leader key you already have configured. |
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"
}
]
]
}
|
Fixes leader key being broken for any config with modifiers, including
the default `ctrl+x`.
`parseLeaderKey("ctrl+x")` expected vim-style `C-x` notation but
OpenCode returns `ctrl+x` format. The parser never recognized the
modifiers, so every match failed silently.
Fix: drop the format translation. New `src/leader.ts` matches against
OpenCode's native `KeyLike` type directly, with modifier alias support
(`control`, `alt`, `option`) and case normalization. Removes
`ParsedLeader`/`parseLeaderKey`/`matchesLeader` from `vim.ts`.
Ref: #22
|
@samuelmasuy thanks! i found the issue, i pesonally use non-modifier leaders since vimcode, but the issue was the mismatch between opencode and vim modifier syntax. can you please re-evaluate? @hamidi-dev i would love you to take either of the 3 changes (dot repeat, undo, V selection) if you want to pursue them, but not combined, so i can more easily review and roll-back as needed. |
|
@oribarilan the PR for V selection is open... |
Using 0.14.0, it fixes the leader in normal mode, but it breaks it in insert mode. |
|
Can you explain what it means "breaks"? In insert mode, leader key is expected to What are you experiencing? |
Assuming my leader is |
|
@samuelmasuy in vim , leader is a normal mode thing, won't work in insert, this is why it is implemented as such. |
|
@samuelmasuy #45 :) will be available in upcoming release. Thanks for the inputs! |
Thank you very much it works as expected. ❤️ |
|
@hamidi-dev i think the dot repeat is the only part left, if you wish to open an issue and/or a dedicated PR for that. Closing this one for now. |
Summary
.repeat for command-based changes likedw,dd,x, andr{char}TabVto select the current line and enter visual modeFixed
dw..now repeats the delete-word changeuafterdw..walks back each repeated delete3dwnow restores in one undo step<leader>e,<leader>l, and<leader>nare no longer swallowed by vimcodeTesting
bun testbunx biome ci --error-on-warnings .