配置exVim开发环境

时间:2022-07-17 21:47:35

exVim主页

http://exvim.github.io/

使用该配置原因:

  • 简单,组织各种优秀插件,安装包很小,各种操作很流畅
  • 实用,对于项目来说,只需要多出一个xx.exvim文件,所有符号等自身文件放在隐藏目录
  • 单个项目可以配置很多xx.exvim文件

注意:exVim主页的用户手册已经很完善,但对于特殊的系统配置可能发生一些错误

1. 编译安装vim 7.4

vim官网http://www.vim.org/sources.php,下载下面三个包

  • vim-7.4.tar.bz2
  • vim-7.2-extra.tar.gz
  • vim-7.2-lang.tar.gz
#解压
tar jxvf vim-7.4.tar.bz2
tar zxvf vim-7.2-extra.tar.gz
tar zxvf vim-7.2-lang.tar.gz
mv vim72 vim74 #编译安装
cd vm74/src
./configure --prefix=/usr/local/vim74 --with-features=huge --enable-pythoninterp --enable-perlinterp --enable-rubyinterp --enable-luainterp --enable-multibyte --enable-sniff --enable-fontset --with-features=huge --enable-pythoninterp --enable-perlinterp --enable-rubyinterp --enable-luainterp --enable-multibyte --enable-sniff --enable-cscope
make && sudo make install #检查版本
vim --version

2. 安装exVim

可以直接参考exVim官方文档: http://exvim.github.io/docs-zh/install/

3. 安装id-utils

exVim依赖了id-utils,如果使用时提示没有id命令则需要安装该软件。

下载地址:ftp://ftp.gnu.org/gnu/idutils/

下载idutils-4.6.tar.xz并解压

cd idutils-4.6/
./configure --prefix=/usr/local/bin/
make && sudo make install
mkid --version

如果make编译时出现下面的错误

n file included from argv-iter.h:17:0,
from argv-iter.c:20:
./stdio.h:1030:1: error: 'gets' undeclared here (not in a function)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
^

解决方案是,将lib/stdio.in.h718行:

_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");

修改为

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif

4. 修正相关配置

  • 修正find

    编辑~/.vim/tools/shell/bash/update-filelist.sh
-type f -not -path "*/\.*"  后置
  • 修正update-tags.sh

    错误提示
/home/admin/.vim/tools//shell/bash/update-tags.sh: line 6: [: =: unary operator expected

修复方法,编辑~/.vim/tools/shell/bash/update-tags.sh,修改第6行为

if [ ${CUSTOM} ]; then
  • 修改tab配置

    编辑~/.vimrc

set tabstop=2
set cindent shiftwidth=2

改为

set tabstop=4
set cindent shiftwidth=4
  • GS查找报错

    快速查找时发现是lid命令存在问题,本地lid --help和之前机器对比发现不一致,在编译目录查找到binary符合预期

5. 安装vim-airline

git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline

编辑~/.vimrc.plugins

修改airline相关行如下

" DISABLE: vim-airline makes Vim editing slow when there are too many buffers opened
" if you don't mind, and love this plugin, uncomment the script below
" to enable it
" vim-airline
" ---------------------------------------------------
Plugin 'bling/vim-airline' if has('gui_running')
let g:airline_powerline_fonts = 1
else
let g:airline_powerline_fonts = 0
endif let g:airline#extensions#tabline#enabled = 1 " NOTE: When you open lots of buffers and typing text, it is so slow.
let g:airline#extensions#tabline#show_buffers = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_section_b = "%{fnamemodify(bufname('%'),':p:.:h').'/'}"
let g:airline_section_c = '%t'
let g:airline_section_warning = airline#section#create(['whitespace']) " NOTE: airline#section#create has no effect in .vimrc initialize pahse
" let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#whitespace#check(),0)}'
" let g:airline_section_warning = ''

6. 颜色配置

推荐Solarized配色方案

http://ethanschoonover.com/solarized

exVim默认就是该配色方案,如果出现字体底部是黑色,可以给.vimrc中添加

let g:solarized_termtrans = 1