在CentOS6上编译安装vim¶
内核开发学习准备工作 是在CentOS 6上进行的,主要是想在一个比较简化(低版本)环境中,学习内核开发、系统开发。所以也就依然需要在CentOS 6这样早期版本上准备开发环境。
为了能够使用最新特性,采用 Vim安装 方法完整编译安装 vim
+ you-complete-me
以及vim插件。
准备工作¶
不论是Debian系还是Fedora系,要完整编译 vim
+ you-complete-me
需要先安装相关库,请擦考 Building Vim from source 。
我主要是在字符界面完成开发(通过ssh登陆到服务器上工作),所以准备库安装略有不同:
sudo yum install -y ncurses-devel ruby ruby-devel lua lua-devel luajit \
luajit-devel ctags git python python-devel \
python34 python34-devel tcl-devel
centos 6 发行版 没有
提供:
luajit
luajit-devel
python3
python3-devel
所以需要采用第三方软件仓库 EPEL安装。注意,CentOS 6已经EOL了,所以需要先 修复CentOS 6软件仓库配置 ,然后执行上述安装 python34
。
编译vim¶
安装前先删除系统之前安装的vim:
yum remove vim-enhanced vim-filesystem vim-common
不过,还是保留 vim-minimal
下载源代码:
cd ~ git clone https://github.com/vim/vim.git cd vim
编译(去除了gui支持):
./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-python3interp=yes \ --with-python3-config-dir=$(python3-config --configdir) \ --enable-luainterp=yes \ --enable-cscope \ --prefix=/usr/local make VIMRUNTIMEDIR=/usr/local/share/vim/vim82 sudo make install
安装Vundle插件管理器¶
Vundle管理插件:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
配置
~/.vimrc
:
install_vim/vimrc_c¶
1set nocompatible
2filetype off
3
4set rtp+=~/.vim/bundle/Vundle.vim
5call vundle#begin()
6
7Plugin 'VundleVim/Vundle.vim'
8
9" Add your plugins below this line
10
11Plugin 'scrooloose/nerdtree'
12Plugin 'valloric/youcompleteme'
13
14" All of your Plugins must be added before the following line
15call vundle#end()
16filetype plugin indent on
17
18" Syntax highlight
19syntax enable
20
21" Tabs are spaces
22set expandtab
23" Number of spaces per tab
24set tabstop=4
25
26" Search as soon as characters are entered
27set incsearch
28" Highlight search results
29set hlsearch
安装插件: 执行
vim
命令,进入编辑器,然后执行::PluginInstall
安装
YouCompleteMe
还需要进一步插件编译:cd ~/.vim/bundle/youcompleteme python3 install.py --clangd-completer
这里只编译支持C系列语言,如果要开发全系列语言则使用参数 --all
,详情参考 Vim安装