nvim (setup copilot)for code assit
仗剑天涯 回首枉然 2024-09-20 16:01:05 阅读 80
4. Work with Neo Vim
4-1. Install Neo Vim (0.9.5 or higher)
neovim/neovim: Vim-fork focused on extensibility and usability (github.com)
~ $ curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
~ $ sudo rm -rf /opt/nvim
~ $ sudo tar -C /opt -xzf nvim-linux64.tar.gz
~ $ export PATH="$PATH:/opt/nvim-linux64/bin"
4-2. Install Node JS
Nodesource Node.js DEB
~ $ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
~ $ sudo apt-get install -y nodejs
4-3. Install plugins
CopilotC-Nvim/CopilotChat.nvim: Chat with GitHub Copilot in Neovim
Put the files in the right place
~ $ mkdir -p ~/.config/nvim/pack/copilotchat/start
~ $ cd ~/.config/nvim/pack/copilotchat/start
~ $ git clone https://github.com/github/copilot.vim.git
~ $ git clone https://github.com/nvim-lua/plenary.nvim
~ $ git clone -b canary https://github.com/CopilotC-Nvim/CopilotChat.nvim
Add to your configuration(e.g. ~/.config/nvim/init.lua)
vim.g.copilot_proxy = '<your proxy server>'
vim.g.copilot_proxy_strict_ssl = false
require("CopilotChat").setup {
debug = true, -- Enable debugging
proxy = '<your proxy server>',
allow_insecure = true,
-- See Configuration section for rest
}
4-4. Start Neo Vim
Start Neo Vim and invoke “:Copilot setup”
You will see the following prompt:
Visit “https://github.com/login/device” with your authorized GitHub Copilot account, and enter the one-time code
Once your device is activated, you will see the following prompts
Then you can write some random comments and invoke :Copilot to see if the copilot is working
Once Copilot is working properly, CopilotChat should also be working properly, please restart Neo Vim and use “:CopilotChat” to open a new window to communicate with CopilotChat
4-5. Docker image
I've pushed a simple docker image with all the configurations, after you create the container you just need to
do step 4-4 to use Copilot.
Pull the Docker image
~ $ docker pull mirrors.sdc.sercomm.com:5000/neovim-copilot:latest
Start the container
~ $ docker run -it --network host --rm -v <your workspace>:/wor
声明
本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。