Set up copilot integration

This commit is contained in:
Haak Saxberg 2023-05-30 12:19:03 -07:00
parent cdc8897467
commit bea0bfef01
2 changed files with 56 additions and 8 deletions

View file

@ -29,6 +29,28 @@ let
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
};
};
copilot-lua = pkgs.vimUtils.buildVimPlugin {
name = "copilot.lua";
version = "2022-05-28";
src = pkgs.fetchFromGitHub {
owner = "zbirenbaum";
repo = "copilot.lua";
rev = "77e3a4907928f0813024e573b882dc879dfc0c6b";
sha256 = "sha256-jBTS8MeN7Ydf0ZY7JWbrxaGo/GeDoEClfULiJVfN8Wo";
};
};
copilot-cmp = pkgs.vimUtils.buildVimPlugin {
name = "copilot-cmp";
version = "2022-05-11";
src = pkgs.fetchFromGitHub {
owner = "zbirenbaum";
repo = "copilot-cmp";
rev = "c2cdb3c0f5078b0619055af192295830a7987790";
sha256 = "sha256-+MzEGnhlrYRvAfskOwmw69OC1CsPXt7s3z+xPe9XPqs";
};
};
in
with builtins;
{
@ -104,14 +126,6 @@ with builtins;
}
undotree
vim-goyo
{
plugin = nvim-cmp;
config = ''
lua << EOF
${ readFile (./nvim-cmp.lua) }
EOF
'';
}
luasnip
cmp-nvim-lsp
{
@ -139,6 +153,39 @@ with builtins;
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
'';
}
{
plugin = copilot-lua;
config = ''
lua << EOF
vim.defer_fn(function()
require('copilot').setup({
-- Disable these features because we're also using copilot-cmp
suggestion = { enabled = false },
panel = { enabled = false },
copilot_node_command = '${pkgs.nodejs-18_x}/bin/node',
})
end, 100)
EOF
'';
}
{
plugin = copilot-cmp;
config = ''
lua << EOF
require('copilot_cmp').setup({})
EOF
'';
}
# have the completion plugin get loaded last just in case anything above
# needs to do setup work before completions get set up.
{
plugin = nvim-cmp;
config = ''
lua << EOF
${ readFile (./nvim-cmp.lua) }
EOF
'';
}
];
extraConfig = readFile ./init.vim;