dustinblackman / oatmeal

Terminal UI to chat with large language models (LLM) using different model backends, and integrations with your favourite editors!
https://dustinblackman.com/posts/oatmeal/
MIT License
477 stars 23 forks source link

feat: New feature: Edit Prompt in editor #70

Open petertrotman opened 4 months ago

petertrotman commented 4 months ago

Hi,

I've made a bit of progress on this feature and I just wanted to get your opinion on whether it is useful enough to pursue and what you think of the code so far.

It is basically functional: When the user types /e or CTRL-E, the current prompt is copied to a tempfile and $EDITOR is launched to edit it there. Once finished, the updated prompt is copied back into the text area.

It doesn't do anything special with oatmeal.nvim so you end up with a second nvim window within nvim, which isn't ideal. I'm pretty sure the fix is to work out what the correct command is to send to the nvim socket and do that instead of lauching a new process, but I'd like to see what you think of this before taking it any further.

There are some tests and documentation is lacking but hopefully it's clear enough.

All the best, Peter

AlfreddGco commented 4 months ago

Sounds good but don't you think a better flow would be to copy the last prompt into the current input box so that the user can edit in there and resend it?

petertrotman commented 4 months ago

Sounds good but don't you think a better flow would be to copy the last prompt into the current input box so that the user can edit in there and resend it?

The idea is to be able to edit a large or complex prompt within your editor of choice, without using the editing features of textbox. I use it often on the command line (C-X C-E in zsh) and have found myself copying the prompt into neovim then back again to edit it in a way I am used to. This feature automates that process.