美食家大橙子 发表于 2024-9-23 18:28:28

nvim (setup copilot)for code assit

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”
https://i-blog.csdnimg.cn/direct/f0f45c43e4a44c8096c06066c60f80db.png
You will see the following prompt:
https://i-blog.csdnimg.cn/direct/ce9ebfb1d4bd49d5b4741f654b4d7b60.png
Visit “https://github.com/login/device” with your authorized GitHub Copilot account, and enter the one-time code
https://i-blog.csdnimg.cn/direct/f25ec357654a46e0ace760731b92b07f.png
Once your device is activated, you will see the following prompts
https://i-blog.csdnimg.cn/direct/7032f69b599a43b482d89754e405b3cc.png

Then you can write some random comments and invoke :Copilot to see if the copilot is working
https://i-blog.csdnimg.cn/direct/3484ce1926174271a0ecfdf70da6b16f.png
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
https://i-blog.csdnimg.cn/direct/4a57fd566abb493c92fde2265689c6ac.png
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

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: nvim (setup copilot)for code assit