vim keybindings along with normal, insert, visual, scroll mode#2713
Closed
Waishnav wants to merge 15 commits into
Closed
vim keybindings along with normal, insert, visual, scroll mode#2713Waishnav wants to merge 15 commits into
Waishnav wants to merge 15 commits into
Conversation
…ode and visual-line mode
…d of line in NORMAL modes
f16de3d to
cc0d460
Compare
Author
|
@thdxr if the opentui version is going to take a while before it’s usable, could you please review this PR? I tried the opentui branch, but it still doesn’t have any vim keybinding mode. Should I try adding vim keybindings like this to that branch instead? |
|
Need this feature. Any reason it is closed? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
I was bored with default keybindings, despite the README of opencode says, it is created by neovim users it still did not had usable vim keybinding support and I wanted a proper vim keybinding so I can stay on the keyboard: hop between normal/insert/visual modes, page through chat history without touching the mouse.
What I touched
Config surface
keybinding_mode: "vim"(JS + Go structs). If you set that flag, we boot directly into vim mode; otherwise everything behaves like before.Status bar
SetModehook and drew a little mode pill with a hint key (esc,i,v,shift+v,s). It rides next to the agent badge so you can see at a glance where you are.Textarea & editor plumbing
Messages component
TUI model
NORMAL,INSERT,VISUAL,VISUAL-LINE,SCROLL), along with per-mode handlers.i,a,o,O,v,shift+v,s.h/j/k/l,w/b/e,0/^/$,x,r<char>.dddeletes the current line without polluting the clipboard.pdrops to a fresh line and pipes through the existing paste flow.yyanks to the clipboard and fires the “Copied to clipboard” toast.ddeletes the selection (no toast, no clipboard side-effect).escsends you back to NORMAL and clears any selection.{}, etc.), withescori/ahopping you back into editing.Testing
No automated coverage here—launch the TUI with
bun devand walk through the key paths.Demo
Here’s a short demo video of the VIM modes in action: https://x.com/_wolf_dev/status/1972399119353405610