编译安装可以使vim带有更多的特性,比如+Python3 +Python +clipboard等等

编译安装

  • 卸载自带vim
1
2
3
sudo apt-get remove -y vim vim-runtime gvim -y

sudo apt-get remove -y vim-tiny vim-common vim-gui-common vim-nox
  • 安装对应依赖
1
2
3
4
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 liblua5.1-dev libperl-dev git
  • 从Github上拉取源码包
1
git clone https://github.com/vim/vim.git
  • 进入源码包,设置编译参数
1
2
3
4
5
6
7
8
9
10
11
12
13
cd vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
--enable-python3interp=yes \
--with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu \
--enable-perlinterp=yes \
--enable-luainterp=yes \
--enable-gui=gtk2 \
--enable-cscope \
--prefix=/usr/local
  • 编译安装
1
2
3
make
sudo make install
sudo ldconfig

将编译好的包打包成deb

  • 安装checkinstall
1
sudo apt-get install checkinstall
  • 进入vim目录
1
2
cd vim
sudo checkinstall
  • 是否生成文档,选”yes”
1
2
The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs? [y]:
  • 输入包的描述
1
2
3
4
Please write a description for the package.
End your description with an empty line or EOF.
>> vim 8.1安装包
>>
  • 改变包的属性
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
*****************************************
**** Debian package creation selected ***
*****************************************

软件包将用下面的值来创建:

0 - Maintainer: [ root@ubuntu ]
1 - Summary: [ Vim 8.1安装包 ]
2 - Name: [ vim ]
3 - Version: [ 20190222 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ checkinstall ]
7 - Architecture: [ amd64 ]
8 - Source location: [ vim ]
9 - Alternate source location: [ ]
10 - Requires: [ ]
11 - Provides: [ vim ]
12 - Conflicts: [ ]
13 - Replaces: [ ]

输入一个数字来改变它们,或按回车键继续:

  • 回车,输入yes,之后等着就行了.此时会自动生成deb包在你的目录下

checkinstall的小技巧

  • 在一些需要编译安装的软件中,在你执行完make之后,不用着急make install,此时可以用checkinstall打包一个deb包,以备你以后安装,下次安装就可以省去编译的时间