ChatGPT.nvim icon indicating copy to clipboard operation
ChatGPT.nvim copied to clipboard

Can't get ChatGPTEditWithInstructions to work with text selected in visual mode

Open ben-wall opened this issue 3 years ago • 1 comments

Vim says 'no range allowed' but it will run with no text selected and run on the last text you selected, but only once you have deselected it.

ben-wall avatar Dec 19 '22 03:12 ben-wall

How are you managing to get it to work in the video? Could you post your keybinding from your lua file for me to test with?

ben-wall avatar Dec 21 '22 06:12 ben-wall

I'm guessing he has a custom keybinding to get it working. Using which-key the following works:

local chatgpt = require("chatgpt")
wk.register({
    p = {
        name = "ChatGPT",
        e = {
            function()
                chatgpt.edit_with_instructions()
            end,
            "Edit with instructions",
        },
    },
}, {
    prefix = "<leader>",
    mode = "v",
})

Basically just setup a keybind for visual mode that calls the edit_with_instructions function. The function is smart enough to detect a visual selection or not.

Akeboshiwind avatar Jan 11 '23 20:01 Akeboshiwind

Wonderful, got this working and learned some things about lua in the process (I'm new to it)

ben-wall avatar Jan 12 '23 09:01 ben-wall

@jackMort was there an actual fix for this? I've just tested it with the latest and still having the same issue.

ben-wall avatar Feb 06 '23 19:02 ben-wall

+1, how is this closed? Shouldn't https://github.com/jackMort/ChatGPT.nvim/pull/58 be merged?

gonzaloserrano avatar Mar 12 '23 20:03 gonzaloserrano