Chinaunix首页 | 论坛 | 博客
  • 博客访问: 213754
  • 博文数量: 42
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 420
  • 用 户 组: 普通用户
  • 注册时间: 2014-03-09 10:55
个人简介

每天改变一点点,生活充满了惊喜。

文章分类

全部博文(42)

文章存档

2016年(8)

2015年(29)

2014年(5)

我的朋友

分类: LINUX

2016-01-01 22:00:36

上一篇介绍了使用与开发代码的一些插件,本篇讲述怎么安装、配置这些插件。

安装插件
使用vim的 Vundle 来管理插件,Vundle的使用可以参考github上的说明:


然后通过配置来管理其他插件,在vimrc文件中加入以下配置项:
  1. " vundle {
  2.     set rtp+=~/.vim/bundle/vundle/
  3.     call vundle#rc()
  4.     Bundle 'gmarik/vundle'

  5.     " 指定插件
  6.     Bundle 'vim-airline'
  7.     Bundle 'ctrlp.vim'
  8.     Bundle 'syntastic'
  9.     Bundle 'rainbow_parentheses.vim'
  10.     Bundle 'vim-unimpaired'
  11.     Bundle 'nerdtree'
  12.     Bundle 'indentLine'
  13.     Bundle 'ack.vim'
  14.     Bundle 'ctrlsf.vim'
  15. "}
当然了,你肯定要先下载这些插件,上篇介绍插件的文章中基本都贴出了github地址,下载不是什么难事。
下载之后将包拷贝至~/.vim 目录即可。
注意:
surround.vim 、matchit 都无需使用vundle来安装。
matchit 上vim自带,配置加载即可。
surround.vim 插件下载后,直接在配置文件source加载。

插件配置
为了使.vimrc文件不至于太膨大,我新建了一个plugin.vim配置文件,这样更清晰,在vimrc文件中加载即可。

  1. " tagbar {
  2.     " 设置按F8键快速启动tagbar
  3.     nmap <F8> :TagbarToggle<CR>
  4.     let g:tagbar_ctags_bin='/usr/bin/ctags'
  5.     let g:tagbar_width=30
  6.     " 让tagbar可以在加载代码时自动打开
  7.     autocmd BufReadPost *.php,*.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen()
  8. "}


  9. " Cscope {
  10.     if has("cscope") && filereadable("/usr/bin/cscope")
  11.        set csprg=/usr/bin/cscope
  12.        set csto=0
  13.        set cst
  14.        set nocsverb
  15.        " add any database in current directory
  16.        if filereadable("cscope.out")
  17.           cs add cscope.out
  18.        " else add database pointed to by environment
  19.        elseif $CSCOPE_DB != ""
  20.           cs add $CSCOPE_DB
  21.        endif
  22.        set csverb
  23.     endif

  24.     "使用时,将光标停留在要查找的对象上,按下",g",
  25.     nmap s :cs find s =expand("<cword>")
  26.     nmap g :cs find g =expand("<cword>")
  27.     nmap c :cs find c =expand("<cword>")
  28.     nmap t :cs find t =expand("<cword>")
  29.     nmap e :cs find e =expand("<cword>")
  30.     nmap f :cs find f =expand("<cfile>")
  31.     nmap i :cs find i ^=expand("<cfile>")$
  32.     nmap h :cs find d =expand("<cword>")
  33. "}

  34. " matchit {
  35.     runtime macros/matchit.vim
  36.     let b:match_words='\:\'
  37. "}


  38. " airline {
  39.   let g:airline_section_b = '%{strftime("%c")}'
  40.   let g:airline#extensions#tabline#enabled = 1
  41.   let g:airline#extensions#tabline#left_sep = ' '
  42.   let g:airline#extensions#tabline#left_alt_sep = '|'
  43.   let g:airline_powerline_fonts = 1
  44.   let g:airline_theme = 'dark'
  45.   set laststatus=2
  46. "}

  47. " syntastic {
  48.     let g:syntastic_check_on_open = 1
  49.     let g:syntastic_cpp_include_dirs = ['/usr/include/']
  50.     let g:syntastic_cpp_remove_include_errors = 1
  51.     let g:syntastic_cpp_check_header = 1
  52.     let g:syntastic_cpp_compiler = 'clang++'
  53.     let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libstdc++'
  54.     "set error or warning signs
  55.     let g:syntastic_error_symbol = '?'
  56.     let g:syntastic_warning_symbol = '?'
  57.     "whether to show balloons
  58.     let g:syntastic_enable_balloons = 1
  59.     let g:syntastic_always_populate_loc_list = 1
"}



阅读(2957) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~