Robitx / gp.nvim

Gp.nvim (GPT prompt) Neovim AI plugin: ChatGPT sessions & Instructable text/code operations & Speech to text [OpenAI, Ollama, Anthropic, ..]
MIT License
787 stars 67 forks source link

feat: introduce convinient commands for GpChatNewVertical, GpChatNewHorizontal, GpChatNewTab #47

Closed divramod closed 11 months ago

divramod commented 11 months ago

my main workflow currently is, that i select some code, and then run <c-g>c for GpChatNew. after that i often go back to the original code with buffer last for having the information to explain chatgpt what i want to do.

it would be nice to have GpNewVertical, GpNewTab, GpNewHorizontal commands to be able to map <c-g>v, <c-g>x, <c-g>t in visual mode, so that i could open the original code buffer and the chat side by side to avoid switching back and forth between the two buffers.

i know, that i could do it somehow by myself, i did it it normal and insert mode like this

vim.keymap.set({"n", "i"}, "<C-g>x", "<cmd>split|GpChatNew<cr>",            keymapOptions("create x"))
vim.keymap.set({"n", "i"}, "<C-g>n", "<cmd>GpChatNew<cr>",                  keymapOptions("create"))
vim.keymap.set({"n", "i"}, "<C-g>t", "<cmd>tabnew|GpChatNew<cr>",           keymapOptions("create t"))
vim.keymap.set({"n", "i"}, "<C-g>v", "<cmd>vsplit|GpChatNew<cr>",           keymapOptions("create v"))

but i think in visual mode it is a little more complicated because i need to keep the selection?

these would be convinient commands to be able to get up and running faster for me and save a lot of time in my daily workflow.

thx again, i am so happy with that plugin!

Robitx commented 11 months ago

@divramod thats already implemented as part of solution for #46 =>

vim.keymap.set({"n", "i"}, "<C-g><C-x>", "<cmd>GpChatNew split<cr>", keymapOptions("New Chat split"))
vim.keymap.set("v", "<C-g><C-x>", ":<C-u>'<,'>GpChatNew split<cr>", keymapOptions("Visual Chat New split"))

supported sub commands are: image

I just have to update the documentation and tag new release (once I also do #48)

Robitx commented 11 months ago

:heavy_check_mark: in the latest version

divramod commented 11 months ago

you are awesome! i think i might go on 🤣

Robitx commented 11 months ago

i think i might go on 🤣

@divramod feat/fix ideas are always welcome :slightly_smiling_face: