opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: vim motions in input box

Open dudeinthemirror opened this issue 5 months ago • 11 comments

Please add the option of using vim keyboard shortcuts when writing the prompt (ClaudeCode has it, see attached)

Image Image

dudeinthemirror avatar Aug 09 '25 21:08 dudeinthemirror

Ah, if you're OK with editing messages in vim.

If you configure the $EDITOR environment variable to be vim in your .profile, .bashrc, .zshrc, or equivalent thing for your shell.

You can launch into your $EDITOR using leader, e (leader by default is ctrl+x. Then you can edit the message in vim or whatever editor you prefer. It's different from having vim mode in the default messaging, but it's nice as you also get your .vimrc customizations.

I didn't realize the editor was for the messaging when I first started using opencode :rofl:, and you can pop into it in the middle of editing a message and it'll handle the contents into vim and out when you write and quit (it does not auto send when you exit the editor).

scaryrawr avatar Aug 10 '25 14:08 scaryrawr

thanks for your reply @scaryrawr but that's a little different. ctrl-x e opens the editor (e.g. vim) in a separate window. I meant supporting vim shortcuts inside the prompt input field. BTW, zed also has this feature for example (ofc that is built into the IDE).

dudeinthemirror avatar Aug 12 '25 00:08 dudeinthemirror

there is a PR for this but not sure if we're going to add this feature at the moment - vim modes tend to be kind of shitty feeling because they end up as partial implementations

thdxr avatar Aug 12 '25 02:08 thdxr

thanks Dax, that makes sense. Please close the issue, or let me know if you want me to do it. Thank you.

dudeinthemirror avatar Aug 13 '25 02:08 dudeinthemirror

I'll just add my 2 cents, as someone who's looking for a vim implementation, that even basic vim modes are helpful / a good start. I'm pairing up opencode with the opencode.nvim plugin and having some sort of vim mode with being able to go into insert mode, out of insert mode, with some of the basic vim navigation keys would help in fitting this more into a vim code editor.

That said, it's just my 2 cents, not a dealbreaker by any means.

AhmedNSidd avatar Aug 13 '25 16:08 AhmedNSidd

+1

zsmatrix62 avatar Aug 15 '25 05:08 zsmatrix62

An ambitious thing would be adding a neovim client to opencode, something like what firenvim does. I imagine you could hijack shift+enter to save and quit the buffer to send the prompt. At least there would be no partial vim mode.

ferdinandyb avatar Oct 11 '25 14:10 ferdinandyb

I'd argue that this is more useful than using external full-fledged editors because some of the built-in autocomplete features such as referencing files by using @ doesn't work quite as well as in the OpenCode's prompt box when you use an external editor. Therefore, it'd be much better if the prompt box itself had a built-in Vim mode, just like Claude Code's TUI.

sepsol avatar Dec 31 '25 19:12 sepsol

Would really love this as without it - it makes using opencode quite awkward for me. I find that using an external editor means I loose context when writing prompts.

ryardley avatar Jan 14 '26 05:01 ryardley

What would be great is that when we open the external editor, the context is opened (like when exporting the current session). It would required to strip out the context before submitting the prompt but would allow all the benefit of neovim (like yanking context content)

MartinDelille avatar Jan 14 '26 10:01 MartinDelille