OpenAIおよびGPTを使用してテキストを生成および編集するためのミニマリストNeovimプラグイン。
<Ctrl-A>
を押すか、実行:AI <prompt>
。vim-plugについては、これをinit.vimに追加します:
Plug ' aduros/ai.vim '
ここで生成できる$OPENAI_API_KEY
という環境変数があることを確認してください。また、 curl
インストールが必要です。
完全なヘルプとカスタマイズオプションを確認するには、実行:help ai.vim
。
最も基本的なユースケースは、挿入モードで<Ctrl-A>
押すことにより完了です。
例えば:
function capitalize ( str : string ) : string {
( Press < Ctrl - A > here )
}
結果:
function capitalize ( str : string ) : string {
return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ;
}
ai.vimはプログラミングだけではありません!定期的な人間のテキストを完成させることもできます。
Hey Joe, here are some ideas for slogans for the new petshop. Which do you like best?
1. <Ctrl-A>
結果:
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!"
また、 <Ctrl-A>
通常モードで押してプロンプトを提供することにより、テキストを生成することもできます。例えば:
:AI write a thank you email to Bigco engineering interviewer
次のようなものになります:
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]
新しいテキストを生成することに加えて、特定の命令を使用して既存のテキストを編集することもできます。
body {
color : orange;
background : green;
}
上記のCSSを視覚的に選択して実行します:AI convert colors to hex
。
body {
color : # ffa500 ;
background : # 008000 ;
}
テキスト編集の別の例:
List of capitals:
1. Toronto
2. London
3. Honolulu
4. Miami
5. Boston
このテキストを視覚的に選択して実行しています:AI sort by population
次のとおりです。
List of capitals:
1. London
2. Toronto
3. Boston
4. Miami
5. Honolulu
長く複雑なプロンプトで独自のショートカットを構築できます。例えば:
vnoremap <silent> <leader> f :AI fix grammar and spelling and replace slang and contractions with a formal academic writing style <CR>
このカスタムマッピングを使用すると、次のようなテキストを選択できます。
Me fail English? That's unpossible!
そして、 <leader>f
を押すことによってそれをこれに変換します:
I failed English? That is impossible!
ai.vimを使用するエキサイティングな方法を思いついた場合は、見つけたものを共有してください!
精度:GPTは、一見して正しいように見えるが、完全に間違っている可能性があるテキストとコードを作成するのが得意です。このプラグインによるすべての出力を慎重に証明してテストしてください!
プライバシー:このプラグインは、完了と編集を生成するときにOpenAIにテキストを送信します。機密情報を含むファイルで使用しないでください。