From 86b7abbe3bd1b5df8e1170bf6ce661082fb40f01 Mon Sep 17 00:00:00 2001 From: Stanley Masinde Date: Fri, 17 Jan 2025 13:57:03 +0300 Subject: [PATCH] Update README.md Add installation instructions for Lazy package manager since most people have an existing Neovim configuration and Cloning might not be very efficient for them. --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index c6b8dae9..cd59e771 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,30 @@ Terms](https://docs.github.com/en/site-policy/github-terms/github-terms-for-addi git clone https://github.com/github/copilot.vim.git ` $HOME/AppData/Local/nvim/pack/github/start/copilot.vim + * Neovim using Lazy package manager. + + Add the following block to your Lazy.nvim configuration: + + ```lua + { + 'github/copilot.vim', + event = "InsertEnter", + config = function() + -- Disable Tab key mapping to prevent conflicts + vim.g.copilot_no_tab_map = true + vim.api.nvim_set_keymap("i", "", 'copilot#Accept("")', { expr = true, silent = true }) + + -- Enable Copilot for specific file types + vim.g.copilot_filetypes = { + ["*"] = false, + python = true, + javascript = true, + lua = true, + } + end, + } + The above sets the accept mapping to `CTRL J`, it is helpful if you have the Tab key mapped for something else. Remove it is the Tab Key is not mapped. + 4. Start Vim/Neovim and invoke `:Copilot setup`. [Node.js]: https://nodejs.org/en/download/