vim工具链环境搭建

来源:互联网 发布:巨人网络招聘2017 编辑:程序博客网 时间:2024/05/02 00:29
1. vim的安装
    sudo apt-get install vim

    vim /etc/vim/vimrc.local(内容如下)
     =========================================================
syntax on
filetype on

set ru

set backspace=indent,eol,start
set whichwrap=b,s,<,>,[,]


set nocompatible
set number
set history=1000
set background=dark

set autoindent
set smartindent

set expandtab
set tabstop=4
set shiftwidth=4

set showmatch
set guioptions-=T
set vb t_vb=
set ruler
set nohls
set cindent
set incsearch
colorscheme evening
    =========================================================

2. cscope + taglist
    sudo apt-get install  exuberant-ctags  cscope global
    mkdir ~/.vim

3. taglist和cppcomplete
    taglist 的下载地址:
    http://www.vim.org/scripts/script.php?script_id=273

     cppcomplete 的下载地址:
     http://www.vim.org/scripts/script.php?script_id=527

     cscope_maps.vim的下载地址:
     http://cscope.sourceforge.net/cscope_maps.vim

     将下载解压后的文件cppcomplete.vim,taglist.vim和cscope_maps.vim拷贝到~/.vim/plugin中

      安装了global后,最新4.8.6 以上版本有带vim的扩展,将它也拷贝到 ~/.vim/plugin
      cp /usr/share/doc/global/examples/gtags.vim.gz ~/.vim/plugin

      gzip -d  gtags.vim.gz

     修改cscope_maps.vim
      nmap <F5>s :cs find s <C-R>=expand("<cword>")<CR><CR>  
      nmap <F5>g :cs find g <C-R>=expand("<cword>")<CR><CR>  
      nmap <F5>c :cs find c <C-R>=expand("<cword>")<CR><CR>  
      nmap <F5>t :cs find t <C-R>=expand("<cword>")<CR><CR>  
      nmap <F5>e :cs find e <C-R>=expand("<cword>")<CR><CR>  
      nmap <F5>f :cs find f <C-R>=expand("<cfile>")<CR><CR>  
      nmap <F5>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
      nmap <F5>d :cs find d <C-R>=expand("<cword>")<CR><CR> 

3. 环境搭建完毕后,就可以方便的使用了!

     需要添加的文件列表:
     /etc/vim/vimrc.local

     ~/.vim/plugin/cppcomplete.vim     (from cppcomplete)
     ~/.vim/plugin/gtags.vim                   (from /usr/share/doc/global/examples/gtags.vim.gz)
     ~/.vim/plugin/taglist.vim                  (from taglist)





0 0