jackMort / ChatGPT.nvim

ChatGPT Neovim Plugin: Effortless Natural Language Generation with OpenAI's ChatGPT API
Apache License 2.0
3.64k stars 312 forks source link

Error: Binding open_chat() #283

Closed rhh4x0r closed 11 months ago

rhh4x0r commented 11 months ago

Hi y'all,

I'm creating bindings for the plugin, and have had success with edit_with_instructions() but it's throwing an error for open_chat(). It's in the API so I'm not sure why this wouldn't work specifically for this case.

Any ideas?

108: Error executing lua: [string ":source (no file)"]:4: attempt to call field 'open_chat' (a nil value)

Code that doesn't work: vim.keymap.set("n", "<leader>l", function() chatgpt.open_chat() end)

Code that works: vim.keymap.set("v", "<leader>k", function() chatgpt.edit_with_instructions() end)

complete_code() also works.

rhh4x0r commented 11 months ago

Solved: Just used this:

vim.keymap.set("n", "<leader>l", ':ChatGPT<CR>')