vim 在centos 升级 vim7.3 并且安装gvim

本文详细描述了在安装VIM时遇到GUI支持缺失的问题,通过安装必要的依赖库,配置参数,并最终成功安装GVIM的过程。包括检查X11头文件,安装libXt-devel和gtk2-devel,清理编译文件,重新配置和安装等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.下载新版本的vim

查询一下:ncurses-devel ,如果没有这个软件,那么需要安装:yum -y install ncurses-devel

[root@localhost vim74]# rpm -qa ncurses-devel
ncurses-devel-5.7-4.20090207.el6.i686

否则在第三步出现:

no terminal library found
checking for tgetent()... configure: error: NOT FOUND!


先安装,第五步有说明

<strong><span style="color:#ff0000;">yum install libXt-devel gtk2-devel</span></strong>

cd /usr/local/src/
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2

2.解压 vim-7.3.tar.bz2

tar jxvf vim-7.3.tar.bz2 

3.进入解压后的vim73目录,进行配置和安装

cd vim73
./configure --enable-gui=auto --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --with-x --prefix=/usr/local/vim73 --enable-pythoninterp=yes
make
make install

4.配置和安装过程并没有报错,但是安装好后却发现只有vim,没有gvim。
使用vim --version或者在vim窗口输入:version,查看
/usr/local/vim73/bin/vim --version
--OR--
/usr/local/vim73/bin/vim
:version

-X11


5.回去发现configure的输出,:

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

6.继续上网查资料,发现是libXt-dev和gtk2-devel包没有安装,使用yum进行安装

yum install libXt-devel gtk2-devel

7.删除刚才的安装并清空编译的中间文件

cd vim73
make uninstall
make clean
rm -f src/auto/config.cache

8.重新运行命令进行编译和安装

cd vim73
./configure --enable-gui=auto --enable-cscope --enable-multibyte --enable-xim --enable-fontset --with-features=huge --with-x --prefix=/usr/local/vim73
make
make install

9. 这次configure的输出:
checking if X11 header files can be found... yes
checking for _XdmcpAuthDoIt in -lXdmcp... yes
checking for IceOpenConnection in -lICE... yes
checking for XpmCreatePixmapFromData in -lXpm... yes
checking if X11 header files implicitly declare return values... no
checking size of wchar_t is 2 bytes... no
checking --enable-gui argument... yes/auto - automatic GUI support
checking whether or not to look for GTK+ 2... yes
checking whether or not to look for GNOME... no
checking whether or not to look for Motif... yes
checking whether or not to look for Athena... yes
checking whether or not to look for neXtaw... yes
checking whether or not to look for Carbon... yes

10.执行以下命令进行链接以便识别vim命令,可以先备份 mv /usr/bin/vim /usr/bin/vim_bak

ln -s /usr/local/vim73/bin/vim /usr/bin/vim
ln -s /usr/local/vim73/bin/gvim /usr/bin/gvim


记录VIM安装一些笔记:

./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu/ --enable-perlinterp --enable-gui=gtk2 --enable-cscope --enable-luainterp --enable-perlinterp --enable-multibyte --prefix=/usr

需要重新配置可 输入 make distclean #清理一下上一次编译生成的所有文件


其中参数说明如下:


--with-features=huge:支持最大特性
--enable-rubyinterp:启用Vim对ruby编写的插件的支持
--enable-pythoninterp:启用Vim对python编写的插件的支持
--enable-luainterp:启用Vim对lua编写的插件的支持
--enable-perlinterp:启用Vim对perl编写的插件的支持
--enable-multibyte:多字节支持 可以在Vim中输入中文
--enable-cscope:Vim对cscope支持
--enable-gui=gtk2:gtk2支持,也可以使用gnome,表示生成gvim
--with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu/ 指定 python 路径
--prefix=/usr:编译安装路径
sudo make VIMRUNTIMEDIR=/usr/share/vim/vim74



sudo make install
<think>我们正在回答用户关于在CentOS7安装Vim编辑器的问题。根据系统级指令,我们需要使用正确的LaTeX格式,使用中文回答,并在回答后生成相关问题。同时,我们需要参考站内引用(尽管这些引用主要是关于MongoDB、Docker、Oracle和JDK的,但我们可以借鉴其中的命令格式和思路)。步骤:1.安装Vim通常使用yum包管理器。2.由于CentOS7默认可能安装了vi,但Vim是增强版,用户可能需要安装vim-enhanced包。3.我们可以参考引用中出现的yum命令格式,例如引用[2]中安装docker-ce依赖的命令。注意:用户可能已经安装vim-minimal,但通常我们安装完整版。安装步骤:步骤1:更新yum包索引(可选,但推荐)步骤2:安装Vim步骤3:验证安装由于引用中并没有直接关于Vim安装的内容,我们按照通用方法进行。生成相关问题:1.如何配置Vim编辑器?2. Vim有哪些常用插件?3.如何在Vim中启用语法高亮?但是,为了更贴合用户可能的需求,我们可以考虑:1.安装特定版本的Vim?2.从源码编译安装Vim3.Vim的基本使用方法?根据用户的问题,我们主要回答安装步骤,然后生成相关问题。回答结构:1.介绍:简要说明Vim及其在CentOS7上的安装方法。2.安装步骤:分步骤说明命令。3.验证安装。4.生成相关问题。注意:由于引用中其他内容不直接相关,我们只参考其命令格式和系统环境(CentOS7,使用yum)。开始回答:</think>### 在 CentOS 7安装 Vim 编辑器 VimCentOS 7 上功能强大的文本编辑器,以下是安装步骤: 1. **更新系统包索引** 首先确保包管理器是最新状态: ```bash sudo yum update ``` 2. **安装 Vim** 执行安装命令: ```bash sudo yum install vim-enhanced ``` > 💡 说明:`vim-enhanced` 包含完整功能,基础版 `vim-minimal` 已预装但功能有限[^1]。 3. **验证安装** 检查版本确认安装成功: ```bash vim --version | head -n 1 ``` 正常输出应显示类似:`VIM - Vi IMproved 7.4` 4. **(可选)安装图形界面版** 若需 GUI 支持: ```bash sudo yum install gvim ``` --- ### 常见问题解决 - **权限问题**:所有命令需 `sudo` 权限执行[^2] - **网络问题**:若安装失败,先检查网络连接 `ping google.com` - **仓库问题**:可尝试 `sudo yum clean all` 清除缓存后重试 --- ### 基础使用示例 ```bash vim filename.txt # 打开文件 i # 进入编辑模式 ESC → :wq # 保存并退出(输入冒号后键入wq) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值