vim-ai icon indicating copy to clipboard operation
vim-ai copied to clipboard

How to get shortcut key for AIChat working in insert mode

Open cduk opened this issue 1 year ago • 1 comments

I'm trying to get AIChat to work with a shortcut so that after typing in a chat message and pressing the hotkey in insert mode it would run AIChat.

So far I have tried this:

inoremap <c-g> <c-o>:AIChat<CR>

But it doesn't work. Instead I tried this:

nnoremap <c-g> :AIChat<CR>i

Which requires me to exit insert mode and then press <c-g> and for some reason it adds a ':' to the start of the next user message.

Has anyone managed to get a kind of seamless chat working?

cduk avatar Mar 25 '24 10:03 cduk

That inoremap <c-g> <c-o>:AIChat<CR> does not work is likely a peculiarity of your set up. You could try inoremap <c-g> <cmd>AIChat<cr> as well on a relatively recent version of Vim.

Konfekt avatar Mar 25 '24 11:03 Konfekt