Vim 8.0

安装Vim 8.0
yum install ncurses-devel wget https://github.com/vim/vim/archive/master.zip unzip master.zip cd vim-master cd src/ ./configure make sudo make install vim

注:make clean仅仅是清除之前编译的可执行文件及配置文件,而make distclean要清除所有生成的文件。

注:编译安装vim8.0,添加python支持 不能同时支持二者
获得python支持,编译时得加入参数

./configure --with-features=huge --enable-python3interp --enable-pythoninterp --with-python-config-dir=/usr/lib64/python2.7/config/ --enable-rubyinterp --enable-luainterp --enable-perlinterp --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/   --enable-multibyte --enable-cscope      --prefix=/usr/local/vim/
参数说明如下:

--with-features=huge:支持最大特性
--enable-rubyinterp:打开对ruby编写的插件的支持
--enable-pythoninterp:打开对python编写的插件的支持
--enable-python3interp:打开对python3编写的插件的支持
--enable-luainterp:打开对lua编写的插件的支持
--enable-perlinterp:打开对perl编写的插件的支持
--enable-multibyte:打开多字节支持,可以在Vim中输入中文
--enable-cscope:打开对cscope的支持
--with-python-config-dir=/usr/lib64/python2.7/config 指定python config路径
--with-python-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ 指定python3 config路径

--prefix=/usr/local/vim:指定将要安装到的路径(自行创建)
对perl组件支持的问题
在编译perl组件支持时,出现如下错误:

/bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$_ $_\n" }}' > auto/if_perl.c
/bin/perl /usr/share/perl5/ExtUtils/xsubpp -prototypes -typemap \
    /usr/share/perl5/ExtUtils/typemap if_perl.xs >> auto/if_perl.c
Can't open perl script "/usr/share/perl5/ExtUtils/xsubpp": No such file or directory
Makefile:2453: recipe for target 'auto/if_perl.c' failed
make[1]: *** [auto/if_perl.c] Error 2
make[1]: Leaving directory '/home/$usr/vim/src/vim74/src'
Makefile:26: recipe for target 'first' failed
make: *** [first] Error 2
解决:
yum install perl-ExtUtils*

     找了下,发现perl5的$lib路径和原先系统的竟然不一样了,在$PELR5/vendor_perl/ExtUtil/中才有连接文件xsubpp。

     接着修改了编译的指向路径,接着编译,却报错:

objects/buffer.o: In function `free_buffer':
/home/$usr/vim/src/vim74/src/buffer.c:661: undefined reference to `perl_buf_free'
objects/ex_docmd.o:(.rodata+0x4678): undefined reference to `ex_perl'
objects/ex_docmd.o:(.rodata+0x4690): undefined reference to `ex_perldo'
objects/window.o: In function `win_free':
/home/$usr/vim/src/vim74/src/window.c:4554: undefined reference to `perl_win_free'
objects/main.o: In function `getout':
/home/$usr/vim/src/vim74/src/main.c:1488: undefined reference to `perl_end'
collect2: error: ld returned 1 exit status
link.sh: Linking failed
Makefile:1733: recipe for target 'vim' failed
make[1]: *** [vim] Error 1
make[1]: Leaving directory '/home/$USR/vim/src/vim74/src'
Makefile:26: recipe for target 'first' failed
make: *** [first] Error 2

     检查src/auto/中的if_perl.c文件,发现竟然是空得,生成失败了。

     根据makefile或者第一个报错的指引,找到生成if_perl.c的命令,手动生成即可:

/bin/perl -e 'unless ( $] >= 5.005 ) { for (qw(na defgv errgv)) { print "#define PL_$_ $_\n" }}' > auto/if_perl.c
/bin/perl /usr/share/perl5/ExtUtils/xsubpp -prototypes -typemap \
    /usr/share/perl5/ExtUtils/typemap if_perl.xs >> auto/if_perl.c

     注意xsubpp的路径。

 


如果出现问题请安装python-dev 再执行上面命令

sudo yum install python-dev

sudo yum install python3-dev

sudo yum install libncurses5-dev

确保 vim 支持 python 2/3 脚本


vim version

从上图可以看出老夫的 vim 版本是 8.0.49 且支持 python3 脚本但不支持 python2 脚本(截图的倒数第 7,8 行)
如果你的打印结果中没有相关 python 脚本信息,还可以在 vim 中键入命令 :echo has('python') || has('python3'),若结果是 1 则证明是支持的。

若不论是 vim 版本不满足条件或者是不支持 python 脚本,那么就需要从源码编译安装 vim 了,

posted @ 2018-06-08 16:18  Awakenedy  阅读(2739)  评论(0编辑  收藏  举报