From 22b35de08e77893cf8ec806f72949175b726680e Mon Sep 17 00:00:00 2001 From: Nick Zana Date: Tue, 30 May 2023 20:44:22 -0400 Subject: [PATCH] add copilot to experiment with --- lua/keybindings.lua | 14 ++++++++++++++ lua/lsp.lua | 3 +++ lua/plugins.lua | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/lua/keybindings.lua b/lua/keybindings.lua index 8b0044c..1105c39 100644 --- a/lua/keybindings.lua +++ b/lua/keybindings.lua @@ -51,6 +51,20 @@ map('n', 'dp', 'diffput', options) map('n', 'gh', 'diffget //2', options) -- merge from left pane map('n', 'gl', 'diffget //3', options) -- merge from right pane +vim.keymap.set( + "i", + "(vimrc:copilot-dummy-map)", + 'copilot#Accept("")', + { silent = true, expr = true, desc = "Copilot dummy accept" } +) + +-- remap copilot key to +vim.g.copilot_no_tab_map = true +vim.g.copilot_assume_mapped = true + +local map = vim.keymap.set +map("i", "", "copilot#Accept('')", {noremap = true, silent = true, expr=true, replace_keycodes = false }) + -- LSP -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer diff --git a/lua/lsp.lua b/lua/lsp.lua index e64ee2b..9b5997a 100644 --- a/lua/lsp.lua +++ b/lua/lsp.lua @@ -23,6 +23,9 @@ local cmp_config = lsp.defaults.cmp_config({ { name = 'nvim_lsp' }, { name = 'luasnip' }, }, + experimental = { + ghost_text = false -- conflicts with copilot.vim's preview + }, }) cmp.setup(cmp_config) diff --git a/lua/plugins.lua b/lua/plugins.lua index 7cf163a..f42bd30 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -23,6 +23,11 @@ local plugins = require('packer').startup(function(use) run = ':TSUpdate' } + use { + 'https://github.com/github/copilot.vim', + keys = "", + } + -- lsp use { 'VonHeikemen/lsp-zero.nvim',