1. 下载gvim并解压
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar -jxvf vim-7.4.tar.bz2
2. 进入解压后的vim74目录并运行配置命令
cd vim74
./configure --enable-gui=auto --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --with-x --prefix=/opt/vim74
3. check是否安装libXt-dev和gtk2-devel包,上述命令如果是下述这样的,则需要安装
checking if X11 header files can be found... no
checking --enable-gui argument... no GUI support
checking X11/SM/SMlib.h usability... no
checking X11/SM/SMlib.h presence... no
checking for X11/SM/SMlib.h... no
no GUI selected; xim has been disabled
no GUI selected; fontset has been disabled
如果是X11是no,则安装libXt-dev和gtk2-devel包
yum install libXt-devel gtk2-devel
4. 重新运行命令并编译
./configure --enable-gui=auto --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --with-x --prefix=/opt/vim74
make
运行后出现下述编译错误:
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
You need to install a terminal library; for example ncurses.
Or specify the name of the library with --with-tlib.
make[1]: *** [config] Error 1
需要安装ncurses库:
yum install ncurses-devel.x86_64
5. 重新运行命令并编译安装
./configure --enable-gui=auto --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --with-x --prefix=/opt/vim74
make
make install
6. 添加vim74路径到path环境变量中
export PATH=$PATH:/opt/vim74/bin
7. 卸载自带的vim72
rpm -qa|grep vim
vim-minimal-7.2.411-1.8.el6.x86_64
vim-enhanced-7.2.411-1.8.el6.x86_64
vim-common-7.2.411-1.8.el6.x86_64
rpm -e vim-minimal-7.2.411-1.8.el6.x86_64 vim-enhanced-7.2.411-1.8.el6.x86_64 vim-common-7.2.411-1.8.el6.x86_64 --nodeps