Neovim配置Perl支持问题

Neovim 将部分功能交给 provider 方式支持,具体技术细节参见:Provider-Neovim docs, 对于python, ruby, node.jsclipboard等配置均比较完美。

问题描述

出现问题的是perl的配置,在我的Thinkpad T490 上发现检查Neovim的健康时无法检测到perl,但是确实已经装上perl了,根据 Provider-Neovim docs 的配置,其他的支持均没有问题,而perl出现警告:

:checkhealth provider-perl
1
2
3
4
5
6
Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
- ADVICE:
- See :help |provider-perl| for more information.
- You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim
- WARNING No usable perl executable found

解决方案(2024-10-09 22:33)

反复安装模块Neovim::Ext

1
2
3
sudo cpanm -n Neovim::Ext

Neovim::Ext is up to date. (0.06)

上述命令无论有没有-n选项都会出现这个提示,不加sudo也是这个提示,这误让我认为我已经安装好模块Neovim::Ext !!

卸载模块Neovim::Ext

1
2
3
4
5
6
sudo cpanm -U Neovim::Ext

!Neovim::Ext is not found in the following directories and can't be uninstalled.

/usr/lib/perl5/5.40/site_perl
/usr/share/perl5/site_perl

这条卸载命令让我意识到,我的系统中其实没有正确安装模块Neovim::Ext,同时新版的Neovim对于在.zshrc中设置的路径方式不再依赖!其实它现在可以直接运行sudo的命令了。

重新安装模块Neovim::Ext

1
2
3
4
5
6
sudo cpanm --reinstall Neovim::Ext

--> Working on Neovim::Ext
Fetching https://www.cpan.org/authors/id/J/JA/JACQUESG/Neovim-Ext-0.06.tar.gz ...OK
...
12 distributions installed

运行完这条命令,则模块Neovim::Ext重新安装成功,再启动nvim运行:checkhealth provider.perl 便得到下述内容:

:checkhealth provider-perl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
provider.perl: require("provider.perl.health").check()

Perl provider (optional) ~
- perl executable: /usr/bin/perl
- OK Latest "Neovim::Ext" cpan module is installed: class is experimental at (eval 8) line 2.
field is experimental at (eval 8) line 4.
method is experimental at (eval 8) line 5.
field is experimental at (eval 8) line 6.
method is experimental at (eval 8) line 7.
field is experimental at (eval 8) line 8.
method is experimental at (eval 8) line 9.
field is experimental at (eval 8) line 10.
method is experimental at (eval 8) line 11.
field is experimental at (eval 8) line 12.
method is experimental at (eval 8) line 13.
field is experimental at (eval 8) line 14.
method is experimental at (eval 8) line 15.
class is experimental at (eval 9) line 2.
field is experimental at (eval 9) line 4.
method is experimental at (eval 9) line 5.
field is experimental at (eval 9) line 6.
method is experimental at (eval 9) line 7.
0.06

总结

这个问题困扰了我一整天,因为总觉得这不应该是一个重大问题,但是两台电脑几乎配置一样,但笔记本上总是不能解决。此次计算机事故,应当牢记遇到问题一般重装程序或模块,同时使用默认配置就可以解决问题。但是,此次没有解决问题的主要原因是对cpanm不够熟悉!所以在cpanm --help后,获取其详细使用规则后就解决了问题。