Fitten code插件(AI代码补全插件)在vim上的使用(Vim插件下载和使用)(plug下载报错)(vim更新)

1.Fitten code是一个vim的ai插件可以通过注释或上下文自动补全代码

下载代码如下

# github install
  mkdir -p ~/.vim/plugin
  curl -o ~/.vim/plugin/fittencode.vim https://raw.githubusercontent.com/FittenTech/fittencode.vim/master/plugin/fittencode.vim

2.下载后使用vim时报错

Error detected while processing VimEnter Autocommands for "*"..function FittenMa
pping:
line    1:
E117: Unknown function: keytrans
Press ENTER or type command to continue
Error detected while processing VimEnter Autocommands for "*"..function FittenMa
pping:
line    3:
E117: Unknown function: keytrans
Press ENTER or type command to continue

这是因为vim插件管理问题

3.可以下载管理器vim-plug

sudo curl -fLo ~/.vim/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

如果报错

curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 61 ms: Connection refused
bash: syntax error near unexpected token `7'

这是因为github 的一些域名的 DNS 解析被污染

具体而言:

    打开 https://www.ipaddress.com/ 输入访问不了的域名,获得对应的IP。

    使用vim /etc/hosts命令打开不能访问的机器的hosts文件,添加如下内容:

    199.232.68.133 raw.githubusercontent.com
    199.232.68.133 user-images.githubusercontent.com
    199.232.68.133 avatars2.githubusercontent.com
    199.232.68.133 avatars1.githubusercontent.com

    注:上面内容中199.232.68.133是raw.githubusercontent.com所在的服务器IP(通过 https://www.ipaddress.com/ 获知)。

    保存该文件,再使用即可正常访问。引用自

http://t.csdnimg.cn/QEC6d

重新下载vim-plug

4.如果继续报错

Error detected while processing VimEnter Autocommands for "*"..function FittenMa
pping:
line    1:
E117: Unknown function: keytrans
Press ENTER or type command to continue
Error detected while processing VimEnter Autocommands for "*"..function FittenMa
pping:
line    3:
E117: Unknown function: keytrans
Press ENTER or type command to continue

可能是因为vim版本过低,下载vim8(非官方下载有一定风险)(官方没有将此版本加入更新包)

sudo add-apt-repository ppa:jonathonf/vim
sudo apt-get update
sudo apt-get install vim

5.如果报错

E: The repository 'https://ppa.launchpadcontent.net/fcitx-team/nightly/ubuntu jammy Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

进入到 /etc/apt/sources.list.d 目录下

sudo vim fossfreedom-ubuntu-indicator-sysmonitor-jammy.list

修改

fossfreedom-ubuntu-indicator-sysmonitor-jammy.list文件(文件名因系统版本而异,大体相似即可)

由
deb https://ppa.launchpadcontent.net/fossfreedom/indicator-sysmonitor/ubuntu/ jammy main
变
# deb https://ppa.launchpadcontent.net/fossfreedom/indicator-sysmonitor/ubuntu/ jammy main

引用http://t.csdnimg.cn/tpD6r

再重新下载vim8

sudo add-apt-repository ppa:jonathonf/vim
sudo apt-get update
sudo apt-get install vim

下载成功后再使用vim报错消失,插件成功加载

6.使用

fitten code 连接完成键入

:Fittenlogin 用户名 密码

显示

Login successful, API key saved  

成功接入

在代码补充处<ctrl+l>自动补全,<tab>接受补全,<ctrl+n>补全列表,目前仅有以上功能。(可以用注释说明需求)

  • 13
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值