1、复制配置文件到本用户环境下,再新建一个.vim文件夹,并创建bundle子文件夹
sudo cp /etc/vim/vimrc /home/wangy/.vimrc sudo mkdir /home/wangy/.vim sudo mkdir /home/wangy/.vim/bundle sudo mkdir /home/wangy/.vim/bundle/vundlebundle的配置文件如下:
| "新增的配置放在这里 set nocompatible " be iMproved filetype off " required! set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage Vundle " required! Bundle 'gmarik/vundle' " My Bundles here: " " original repos on github Bundle 'tpope/vim-fugitive' Bundle 'Lokaltog/vim-easymotion' Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} Bundle 'tpope/vim-rails.git' " vim-scripts repos Bundle 'L9' Bundle 'FuzzyFinder' " non github repos " Bundle 'git://git.wincent.com/command-t.git' " Bundle 'https://github.com/scrooloose/nerdtree.git' " ... filetype plugin indent on " required! " " Brief help -- 此处后面都是vundle的使用命令 " :BundleList - list configured bundles " :BundleInstall(!) - install(update) bundles " :BundleSearch(!) foo - search(or refresh cache first) for foo " :BundleClean(!) - confirm(or auto-approve) removal of unused bundles " " see :h vundle for more details or wiki for FAQ " NOTE: comments after Bundle command are not allowed.. |
2、安装NERDTree
Bundle 'https://github.com/scrooloose/nerdtree.git'
用法如下:
| nmap <F5> :NERDTree<CR> 快捷键 |
:NERDTree 开启
ctrl+w 可以在左右窗口切换
p 到上层目录,P到根目录
o 打开文件或目录,q 退出插件
3、安装tagbar
首先安装ctags,sudo apt-get install ctags
Bundle 'https://github.com/majutsushi/tagbar.git'
配置文件如下:
| " tagbar设置---------------- " 快捷键 nmap <F4> :TagbarToggle<CR> let g:tagbar_width = 20 " tagbar's width, default 20 " let g:tagbar_left = 1 " on the left side let g:tagbar_right = 1 " on the right side let NERDTreeIgnore=['.pyc', '.pyo', '.swp', '~'] " ignore *.py[co], *.sw p and *~ |
使用方式F4快捷键,退出为q
4、其他插件
Bundle 'https://github.com/scrooloose/nerdtree.git'
Bundle 'https://github.com/majutsushi/tagbar.git'
Bundle 'https://github.com/terryma/vim-multiple-cursors.git'
Bundle 'https://github.com/upsuper/vim-colorschemes.git'
Bundle 'https://github.com/vim-scripts/cppcomplete.git'
我的vim配置主要有以下优点:
1.按F5可以直接编译并执行C、C++、java代码以及执行shell脚本,按“F8”可进行C、C++代码的调试
2.自动插入文件头 ,新建C、C++源文件时自动插入表头:包括文件名、作者、联系方式、建立时间等,读者可根据需求自行更改
3.映射“Ctrl + A”为全选并复制快捷键,方便复制代码








