提前准备
为了脚本能顺利运行,需要预先安装好如下几个软件: - curl
- jq
- wget
下载源代码
从github
下载vim
,好处是可以自由切换版本。
1 2 3 4 5 6 7 8 9 10
|
file=vim-latest.tar.gz api="https://api.github.com/repos/vim/vim/tags" download_url=$(curl -s $api | jq -r ".[] | .tarball_url" | awk 'NR==1{print}') latest_version=$(curl -s $api | jq -r ".[] | .name" | awk 'NR==1{print}')
wget -O $file $download_url
|
解压,进入目录
1 2 3 4 5 6
| mkdir vim-latest tar -zxf vim-latest.tar.gz -C vim-latest --strip-components=1 cd vim || exit
git describe --tags
|
编译安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| make distclean
./configure \ --prefix=$HOME/Program/vim/${latest_version##*v} \ --enable-multibyte=yes \ --enable-gui=gtk2 \ --with-x \ --with-features=huge \ --enable-python3interp=yes \ --enable-perlinterp=yes \ --enable-rubyinterp=yes \ --enable-luainterp=yes \ --with-luajit \ --enable-cscope \ --with-compiledby=徐武涛 \
make -j 16 && make install
|
卸载
vim
的Makefile
提供了uninstall
选项,因此卸载很容易。
1
| cd vim && make uninstall
|