Usage - madox2/vim-ai GitHub Wiki
Related documentation:
:AIE
, :AIC
, :AIR
, :AIN
Use shorthands Instead of the full command, you can use a shorthand, for example:
Instead of using the entire command, you can use a shorthand. For example, :AIE make it an enum
is the same as :AIEdit make it an enum
.
This is a built-in vim feature but it is still worth mentioning.
You will also find references to shorthands rather than full commands in the wiki.
Get an alternative suggestions
To get an alternative suggestion, use :AIR
or press your redo shortcut.
However, this might not give you a different completion in every situation as it heavily depends on the temperature
parameter.
What generally works is:
- Increasing the temperature parameter, e.g.:
:let g:vim_ai_edit['options']['temperature'] = 0.9
- If
:AI
and:AIE
do not provide an alternative, run and redo the prompt in the chat:AIC
, which by default, has a higher temperature
Complete a block of code
Sometimes it is needed for more context for the best quality completions. Often it helps to put code both below and/or after the cursor. You can put a comment to the code where the completion should take place. For example, with the code below selected:
import moment from 'moment';
function formatMonth(date) {
// TODO: display invalid dates as N/A
return moment(date).format('MM-YYYY');
}
You can simply run command :AIE complete TODO comment
Initialize chat with a prompt
Like with :AI
and :AIE
, the combination of instructions and selection works with the :AIC
command.
So for example you can visually select a code block and run a prompt: :'<,'>AIC check for bugs and code smells
:AINewChat
(:AIN
) to place a new chat window
Use For example: :AIN tab
, :AIN right