Bryley / neoai.nvim

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

[suggestion]: automatically enter insert mode for neoai-prompt (when running :NeoAI) #48

Open bcp-dev-ops opened 1 year ago

bcp-dev-ops commented 1 year ago

This would be a huge ergonomic improvement.

Been struggling this morning trying to write an autocommand that enters in insert mode on BufEnter for neoai-prompt buffers; however, have not been fruitful. It seems like there is something async happening that makes this difficult.

Thanks for your consideration

joeldrotleff commented 8 months ago

This works for me, define a mapping to open NeoAI and then type 'i' afterwards to enter insert mode: ["<leader>na"] = { ":NeoAI<CR>i", "Smart toggle NeoAI window" },

(I use NVChad)

I think the raw lua to use would be:

vim.api.nvim_set_keymap('n', '<leader>na', ':NeoAI<CR>i', { noremap = true, desc = 'Smart toggle NeoAI window' })