AI Completion In The Shell
From Rest of What I Know
LLMs are fantastic for programming. I use ChatGPT, Claude, and Copilot routinely. One place where I didn't have a good workflow was my terminal, but I found a way that I find quite pleasant and I've been using it for a few months.
Steps
1. Install neovim
2. Install Copilot on it using copilot.vim
3. Set EDITOR=nvim
4. Use Ctrl-X Ctrl-E at your command-prompt to enter your Neovim-enabled Copilot
Additional Tips
Here's my ~/.config/nvim/init.vim
for the relevant bits. I use vim-plug
which I've found quite useful to manage vim plugins.
call plug#begin()
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'github/copilot.vim'
call plug#end()
" Deoplete
let g:deoplete#enable_at_startup = 1
"" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<TAB>"
I also use zsh
with oh-my-zsh
and starship.rs so entering and leaving this is quite easy and pleasant. I can type some at the command-prompt and then go back to nvim
and so on because it will expand things like !!
and so on.