From 7b6b1f9247ff248a22fa3cf109ebc35a4e51fcff Mon Sep 17 00:00:00 2001 From: buffet Date: Mon, 3 Apr 2023 18:40:02 +0200 Subject: [PATCH] feat: setup copilot --- flake.lock | 34 ++++++++++++++++++++++++++++++++++ flake.nix | 10 ++++++++++ programs/nvim.nix | 13 ++++++++++--- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 46973f2..9f7397b 100644 --- a/flake.lock +++ b/flake.lock @@ -53,6 +53,38 @@ "type": "github" } }, + "copilot-cmp": { + "flake": false, + "locked": { + "lastModified": 1677432266, + "narHash": "sha256-Bu9Lx+1H1pG97ibwn8Q7jOHOKOrzg1nyucTTqbdlapI=", + "owner": "zbirenbaum", + "repo": "copilot-cmp", + "rev": "92535dfd9c430b49ca7d9a7da336c5db65826b65", + "type": "github" + }, + "original": { + "owner": "zbirenbaum", + "repo": "copilot-cmp", + "type": "github" + } + }, + "copilot-lua": { + "flake": false, + "locked": { + "lastModified": 1679135186, + "narHash": "sha256-ibp46ZQptwEqgaI03ANSbDV+lCaBe9uO0DkIAog8dgo=", + "owner": "zbirenbaum", + "repo": "copilot.lua", + "rev": "db62371b6eac73954c194f3c8faee36cffee8135", + "type": "github" + }, + "original": { + "owner": "zbirenbaum", + "repo": "copilot.lua", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -180,6 +212,8 @@ "agenix": "agenix", "cmp-conventionalcommits": "cmp-conventionalcommits", "cmp-git": "cmp-git", + "copilot-cmp": "copilot-cmp", + "copilot-lua": "copilot-lua", "gh-nvim": "gh-nvim", "home-manager": "home-manager", "impermanence": "impermanence", diff --git a/flake.nix b/flake.nix index 7c2d1f9..f2598a8 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,16 @@ flake = false; }; + copilot-cmp = { + url = "github:zbirenbaum/copilot-cmp"; + flake = false; + }; + + copilot-lua = { + url = "github:zbirenbaum/copilot.lua"; + flake = false; + }; + gh-nvim = { url = "github:ldelossa/gh.nvim"; flake = false; diff --git a/programs/nvim.nix b/programs/nvim.nix index 3111a12..3a223b5 100644 --- a/programs/nvim.nix +++ b/programs/nvim.nix @@ -60,13 +60,20 @@ { plugin = cmp-git; - config = "lua require 'cmp_git'.setup()"; + config = "lua require 'cmp_git'.setup {}"; + } + + { + plugin = copilot-vim; + config = '' + let g:copilot_node_command = "${pkgs.nodejs-16_x}/bin/node" + ''; } { plugin = crates-nvim; config = '' - lua require 'crates'.setup() + lua require 'crates'.setup {} nnoremap ${leader}ct :lua require('crates').toggle() nnoremap ${leader}cr :lua require('crates').reload() @@ -272,7 +279,7 @@ documentation = cmp.config.window.bordered(), }, mapping = { - [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping.select_prev_item(select_opts), [''] = cmp.mapping.select_next_item(select_opts), [''] = cmp.mapping.scroll_docs(4),