Enable YAML for Copilot in VIM

Copilot is an AI-based suggestion tool designed to suggest code completion as developers type and turns natual language prompts into coding suggestions. Here’s a little example:

asciicast

The only problem is that Copilot disables by default some filetype, and YAML is one of those. And, as we all may know, YAML is the language used to write kubernetes manifests… So it might be iomportant for your AI assistent to help with that.

How to fix then? Well, in VIM, what you can do is remove yaml from filetype_defaults here which will be something like the following:

diff --git a/autoload/copilot.vim b/autoload/copilot.vim
index 97beb55..dfa36bf 100644
--- a/autoload/copilot.vim
+++ b/autoload/copilot.vim
@@ -152,7 +152,6 @@ function! copilot#Dismiss() abort
 endfunction
 
 let s:filetype_defaults = {
-      \ 'yaml': 0,
       \ 'markdown': 0,
       \ 'help': 0,
       \ 'gitcommit': 0,

The only problem is that whenever you update your plugin, that list will get overwritten when the plugin gets updated, but as a workaround is ok-ish.

Reference