nvim (setup copilot)for code assit

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”


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

总结

### 文章总结:在Neo Vim中集成GitHub Copilot
#### 1. 安装Neo Vim
- **版本要求**:确保安装Neo Vim 0.9.5或更高版本。
- **安装步骤**:
- 使用curl命令从GitHub下载Neo Vim的Linux 64位版本。
- 清理并解压到`/opt/nvim-linux64`目录。
- 将Neo Vim的bin目录添加到PATH环境变量中。
#### 2. 安装Node.js
- **使用Nodesource Node.js DEB**:
- 通过curl命令安装Node.js 20.x版本。
- 使用apt-get安装nodejs。
#### 3. 安装插件
- **安装CopilotChat.nvim**:
- 在`~/.config/nvim/pack/copilotchat/start`目录下创建文件夹并克隆相关插件仓库。
- 包括`copilot.vim`、`plenary.nvim`和`CopilotChat.nvim`(使用canary分支)。
- **配置Neo Vim**:
- 在`~/.config/nvim/init.lua`文件中添加CopilotChat的配置,包括代理设置和调试选项。
#### 4. 启动Neo Vim并设置GitHub Copilot
- **启动Neo Vim**:
- 输入`:Copilot setup`命令开始设置。
- **激活GitHub Copilot**:
- 访问`https://github.com/login/device`并使用授权的GitHub Copilot账户登录。
- 输入一次性代码以激活设备。
- **测试Copilot**:
- 编写一些随机注释并调用`:Copilot`查看是否工作正常。
- 如果Copilot工作正常,则CopilotChat也应正常工作。
- 重启Neo Vim并使用`:CopilotChat`命令打开新窗口与CopilotChat通信。
#### 5. 使用Docker镜像
- **拉取Docker镜像**:
- 使用`docker pull`命令从指定仓库拉取包含所有配置的Neo Vim Docker镜像。
- **启动Docker容器**:
- 使用`docker run`命令启动容器,并挂载你的工作空间到容器中。
- 容器启动后,只需按照步骤4-4设置GitHub Copilot即可开始使用。
通过以上步骤,你可以在Neo Vim中成功集成并使用GitHub Copilot及其聊天插件CopilotChat,提升你的编码效率和体验。 copilotgitgithubchatdockerdocgithub copilotproxylinuxurlnode.jsclonenodejsdebugpromptmun编码效率文件夹createcode
  • 本文作者:李琛
  • 本文链接: https://wapzz.net/post-21179.html
  • 版权声明:本博客所有文章除特别声明外,均默认采用 CC BY-NC-SA 4.0 许可协议。
本站部分内容来源于网络转载,仅供学习交流使用。如涉及版权问题,请及时联系我们,我们将第一时间处理。
文章很赞!支持一下吧 还没有人为TA充电
为TA充电
还没有人为TA充电
0
  • 支付宝打赏
    支付宝扫一扫
  • 微信打赏
    微信扫一扫
感谢支持
文章很赞!支持一下吧
关于作者
2.3W+
5
0
1
WAP站长官方

【AI画图】stable-diffusion-webui学习之一《安装部署》

上一篇

使用 CTranslate2 实现 Faster Whisper 的加速转录

下一篇
  • 复制图片
按住ctrl可打开默认菜单