Created
February 2, 2025 16:50
-
-
Save scottstensland/0987e22e59d3881cecf08f89a64334bf to your computer and use it in GitHub Desktop.
vim or neovim how to enable or disable copilot in your edit session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
below is taken from the excellent video tut | |
Quickly Turn off Vim's Copilot - i.e. When Learning | |
https://www.youtube.com/watch?v=qhZYfVpC3fg | |
add below snippet to your ~/.vimrc | |
to map F12 key to toggle on / off github copilot for your vim or neovim | |
vi ~/.vimrc | |
``` | |
" start of copilot overrides | |
:imap <C-M-[> >Plug>(copilot-previous) | |
:imap <C-M-]> >Plug>(copilot-next) | |
function! ToggleCopilot() | |
" FYI https://github.com/github/copilot.vim/blob/release/autoload/copilot.vim | |
" FYI only global toggle, not toggling buffer local | |
if copilot#Enabled() | |
Copilot disable | |
else | |
Copilot enable | |
endif | |
" echo "copilot is: " . (g:copilot_enabled ? "on" : "off") | |
Copilot status " visual confirmation - precise about global vs buffer local too | |
endfunction | |
:inoremap <F12> <Esc>:call ToggleCopilot()<CR>a | |
:nnoremap <F12> :call ToggleCopilot()<CR> | |
" end of copilot overrides | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment