温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Centos7怎么编译安装vim8

发布时间:2021-08-31 21:14:16 来源:亿速云 阅读:116 作者:chen 栏目:建站服务器

这篇文章主要讲解了“Centos7怎么编译安装vim8”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Centos7怎么编译安装vim8”吧!

环境

  • Centos7.7 Minimal

  • vim-8.2.221

安装VIM8

需要先安装依赖包还有常用工具包:

[root@localhost ~]# yum -y install git ncurses-devel ruby ruby-devel lua lua-devel perl perl-devel python3 python3-devel python2-devel perl-ExtUtils-Embed lrzsz cmake wget gcc gcc-c++ unzip

从github仓库下载最新的vim安装包

[root@localhost ~]# git clone https://github.com/vim/vim

开始编译安装vim

[root@localhost ~]# cd vim-master/
[root@localhost vim-master]# ./configure --with-features=huge \
            --enable-rubyinterp=yes \
            --enable-luainterp=yes \
            --enable-perlinterp=yes \
            --enable-python3interp=yes \
            --enable-pythoninterp=yes \
            --with-python-config-dir=/usr/lib64/python2.7/config \
            --with-python3-config-dir=/usr/lib64/python3.6/config-3.6m-x86_64-linux-gnu \
            --enable-fontset=yes \
            --enable-cscope=yes \
            --enable-multibyte \
            --disable-gui \
            --enable-fail-if-missing \
            --prefix=/usr/local \
            --with-compiledby='Professional operations'
[root@localhost vim-master]# make VIMRUNTIMEDIR=/usr/local/share/vim/vim82 && make install
  1. --enable-fail-if-missing 表示问题会提示报错,并停止

  2. --enable-***interp=yes 表示加入***支持

  3. --with-***-config-dir=*** 表示指定配置文件路径

  4. make VIMRUNTIMEDIR=*** 表示指定VIM可执行文件的位置

执行vim查看一下版本

[root@localhost ~]# vim

Centos7怎么编译安装vim8

如何安装vim插件?

Vim编辑器安装自己喜欢的插件之后,使用起来会方便许多。

安装插件管理器

这里安装两个工具,一个是pathogen ,还有一个就是vimogen。
Pathogen插件用来集中管理vim的插件,Vimogen配合pathogen使用的,在~/.vimogen_repos中添加插件的地址,然后运行vimogen,自动安装.vimogen_repos里面的插件,插件安装的目录是pathogen管理的目录。

先安装pathogen:

[root@localhost ~]# mkdir -p .vim/{autoload,bundle}
[root@localhost ~]# curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim

在家目录创建.vimrc文件,如果有就不用创建了。在.vimrc文件里面添加如下内容:

vim ~/.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set hlsearch
set backspace=indent,eol,start

然后再安装vimogen:

[root@localhost ~]# git clone https://github.com/rkulla/vimogen
[root@localhost ~]# cp -p vimogen/vimogen /usr/local/bin/

创建~/.vimogen_repos文件,这里面的插件是我需要用到的。

[root@localhost ~]# vim ~/.vimogen_repos
https://github.com/ianva/vim-youdao-translater
https://github.com/scrooloose/nerdtree

Centos7怎么编译安装vim8
运行vimogen 命令,然后输入1,进行安装操作:

[root@localhost ~]# vimogen
1) INSTALL
2) UNINSTALL
3) UPDATE
4) EXIT
Enter the number of the menu option to perform: 1

Centos7怎么编译安装vim8
Centos7怎么编译安装vim8
Centos7怎么编译安装vim8

配置.vimrc文件,启用刚刚安装的两个插件

[root@localhost ~]# vim .vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
set hlsearch
set backspace=indent,eol,start
"===============nerdtree=================
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
map:NERDTreeToggleautocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"===============vim-youdao-translator=================
vnoremap:Ydvnnoremap:Ydcnoremapyd :Yde

演示一下插件

nerdtree

nerdtree实现在左侧显示目录树功能,效果如下:
按ctrl+n键 来打开或关闭目录树。
Centos7怎么编译安装vim8
可以在目录树里面创建文件或目录。在目录树激活状态下,按m,打开菜单,然后可以选择创建,删除等操作。
Centos7怎么编译安装vim8
输入a,来创建文件或目录
Centos7怎么编译安装vim8
加上“/”是创建目录,不加”/”创建文件。

vim-youdao-translator

目前只会用这个插件划词翻译,哈哈哈

光标移动到单词上面,然后按ctrl+t就可以翻译了,译文会在编辑器底部的命令栏显示
Centos7怎么编译安装vim8

感谢各位的阅读,以上就是“Centos7怎么编译安装vim8”的内容了,经过本文的学习后,相信大家对Centos7怎么编译安装vim8这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是亿速云,小编将为大家推送更多相关知识点的文章,欢迎关注!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI