Bryley / neoai.nvim

Neovim plugin for intracting with GPT models from OpenAI
MIT License
558 stars 51 forks source link

<Enter> still submits even when configuring a new submit keybinding #47

Open alextes opened 1 year ago

alextes commented 1 year ago

For whatever reason doesn't insert a newline for me (macos, kitty) not sure why but that's okay, I'd prefer the editing I'm used to in neovim, enter being newline in insert mode. So I updated my config like so:

return {
    "Bryley/neoai.nvim",
    dependencies = {
        "MunifTanjim/nui.nvim",
    },
    cmd = {
        "NeoAI",
        "NeoAIOpen",
        "NeoAIClose",
        "NeoAIToggle",
        "NeoAIContext",
        "NeoAIContextOpen",
        "NeoAIContextClose",
        "NeoAIInject",
        "NeoAIInjectCode",
        "NeoAIInjectContext",
        "NeoAIInjectContextCode",
    },
    keys = {
        { "<leader>as", desc = "summarize text" },
        { "<leader>ag", desc = "generate git message" },
    },
    config = function()
        require("neoai").setup({
            ui = {
                submit = "<C-m>",
                quit = "<C-c>",
                quit_context = "<C-c>",
                width = 30,
            },
            models = {
                {
                    name = "openai",
                    model = "gpt-4",
                    -- model = "gpt-3.5-turbo",
                    params = nil,
                },
            },
        })
    end,
}

Although works, also still works and what I really want is normal newlines on enter. So maybe this is a feature request to have an option for normal newline on enter behavior, or maybe it's an issue where setting the submit key doesn't control the submit key, either way, I'd really like the normal neovim behavior, any ideas for how to handle this best?

Thanks for this great plugin. Kinda crazy that all the others I've seen require to manually yank anything you want to talk to the AI about. NeoAIContext is a great improvement 👏 .