Un complemento neovim minimalista para generar y editar texto utilizando OpenAI y GPT.
<Ctrl-A>
o ejecute :AI <prompt>
.Para vim-plug, agregue esto a su init.vim:
Plug ' aduros/ai.vim '
Asegúrese de tener una variable de entorno llamada $OPENAI_API_KEY
que puede generar aquí. También necesitará curl
instalado.
Para ver las opciones completas de ayuda y personalización, ejecute :help ai.vim
.
El caso de uso más básico es la finalización, presionando <Ctrl-A>
en modo de inserción.
Por ejemplo:
function capitalize ( str : string ) : string {
( Press < Ctrl - A > here )
}
Resultará en:
function capitalize ( str : string ) : string {
return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ;
}
¡Ai.vim no es solo para programar! También puede completar el texto humano regular:
Hey Joe, here are some ideas for slogans for the new petshop. Which do you like best?
1. <Ctrl-A>
Resultados en:
Hey Joe, here are some ideas for slogans for the new petshop. Which do you like best?
1. "Where Pets Come First!"
2. "Your Pet's Home Away From Home!"
3. "The Best Place for Your Pet!"
4. "The Pet Store That Cares!"
5. "The Pet Store That Loves Your Pet!"
También puede generar algún texto presionando <Ctrl-A>
en modo normal y proporcionando un aviso. Por ejemplo:
:AI write a thank you email to Bigco engineering interviewer
Resulta en algo como:
Dear [Name],
I wanted to take a moment to thank you for taking the time to interview me for the engineering
position at Bigco. I was very impressed with the company and the team, and I am excited about the
possibility of joining the team.
I appreciate the time you took to explain the role and the company's mission. I am confident that I
have the skills and experience to be a valuable asset to the team.
Once again, thank you for your time and consideration. I look forward to hearing from you soon.
Sincerely,
[Your Name]
Además de generar texto nuevo, también puede editar el texto existente utilizando una instrucción dada.
body {
color : orange;
background : green;
}
Seleccionar visualmente el CSS anterior y en ejecución :AI convert colors to hex
da como resultado:
body {
color : # ffa500 ;
background : # 008000 ;
}
Otro ejemplo de edición de texto:
List of capitals:
1. Toronto
2. London
3. Honolulu
4. Miami
5. Boston
Seleccionando visualmente este texto y en ejecución :AI sort by population
resulta en:
List of capitals:
1. London
2. Toronto
3. Boston
4. Miami
5. Honolulu
Puede construir sus propios atajos para indicaciones largas y complejas. Por ejemplo:
vnoremap <silent> <leader> f :AI fix grammar and spelling and replace slang and contractions with a formal academic writing style <CR>
Con este mapeo personalizado puede seleccionar texto que se vea así:
Me fail English? That's unpossible!
Y presionando <leader>f
transformarlo en esto:
I failed English? That is impossible!
Si se te ocurre una forma emocionante de usar AI.VIM, ¡comparte lo que encuentre!
Precisión : GPT es bueno para producir texto y código que se ve correcto a primera vista, pero puede estar completamente equivocado. ¡Asegúrese de probar cuidadosamente leer y probar todo lo que sale por este complemento!
Privacidad : este complemento envía texto a OpenAI al generar finalizaciones y ediciones. No lo use en archivos que contienen información confidencial.