原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://ttsky138.blog.51cto.com/3282968/641094
检查是否安装了vim,ctags,cscope,如果没有请安装。
我的配置文件--vimrc.(来自网络了,作者找不到了。。。抱歉啦)
- set tags=./tags;
- set helplang=cn
- set autochdir
- set cindent
- set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
- set expandtab
- set fileencodings=ucs-bom,utf8,GB18030,Big5,latin1
- set fileformat=unix
- set cursorline
- set history=50
- set hlsearch
- set ignorecase
- set incsearch
- set laststatus=2
- set nobackup
- set nocompatible
- set number
- "set paste
- set ruler
- set shiftwidth=4
- set showcmd
- set showmatch
- set smartcase
- set smartindent
- set softtabstop=4
- set statusline=%F%m%r,\ %Y,\ %{&fileformat}\ \ \ ASCII=\%b,HEX=\0x\%B\ \ \ %l,%c%V\ \ %p%%
- set tabstop=4
- colorscheme desert
- "set nocscopeverbose
- syntax enable
- syntax on
- filetype plugin indent on
- set completeopt=longest,menu
- "hi Cursorline ctermbg=Blue guibg=#3CF60B
- ":map <C-F9> :!g++ % -o %<<CR>
- :map <F9> :!g++ -Wall -ggdb % -o %<<CR>
- :map <F10> :!./%<<CR>
- :map <C-c> :!clear<CR>
- :map <F6> :tabprevious<CR>
- :map <F7> :tabnew<CR>
- :map <F8> :tabnext<CR>
- :map <F2> :w<CR>
- "runtime! debian.vim
- "if filereadable("/etc/vim/vimrc.local")
- " source /etc/vim/vimrc.local
- "endif
- if &term=="xterm"
- set t_Co=8
- set t_Sb=^[[4%dm
- set t_Sf=^[[3%dm
- endif
- """""""""""""""""""""""""""
- " Use mouse on console
- """""""""""""""""""""""""""
- if has("wildmenu")
- set mouse =a
- endif
- " Set text-mode menu
- if has("wildmenu")
- " Use menu
- source $VIMRUNTIME/menu.vim
- set cpoptions-=<
- set wildcharm=<C-Z>
- map <F4> :emenu <C-Z>
- endif
- """"""""""""""""""""""""""""""
- " Tag list (ctags)
- """"""""""""""""""""""""""""""
- nnoremap <silent> <F8> :TlistToggle<CR>
- let Tlist_Ctags_Cmd = '/usr/bin/ctags'
- let Tlist_Show_One_File = 1
- let Tlist_Exit_OnlyWindow = 1
- let Tlist_Use_Left_Window = 0
- let Tlist_Sort_Type = 'name'
- let Tlist_Auto_Open = 1
- let Tlist_Auto_Update = 1
- let Tlist_WinWidth = 25
- let Tlist_Use_Right_Window= 1
- let Tlist_File_Fold_Auto_Close=1
- if $VIM_HATE_SPACE_ERRORS != '0'
- let c_space_errors=1
- endif
- """"""""""""""""""""""""""""""""
- " Window manager settings
- """"""""""""""""""""""""""""""""
- nmap wm :WMToggle<CR>
- map <c-w><c-f> :FirstExplorerWindow<cr>
- map <c-w><c-b> :BottomExplorerWindow<cr>
- let persistentBehaviour=0
- let winManagerWidth=25
- "if has("cscope")
- " set csprg=/usr/bin/cscope
- " set csto=0
- " set cst
- " set nocsverb
- " " add any database in current directory
- " if filereadable("cscope.out")
- " cs add ./cscope.out
- " " else add database pointed to by environment
- " elseif $CSCOPE_DB != ""
- " cs add $CSCOPE_DB
- " endif
- " set csverb
- " set cscopetag
- " set cscopequickfix=s-,g-,c-,d-,t-,e-,f-,i-
- "endif
安装taglist和winmanager
下载地址分别是:taglist winmanager
安装方法嘛,下载页已经说明了,我就偷个懒了。
安装cscope_maps.vim
下载地址:cscope_maps.vim (另存为就可以了)
安装方法同taglist和winmanager(我都是直接放/usr/share/vim/vim73/下的相应目录了,免得切换用户麻烦)。
将下面的脚本保存到/usr/bin下,命名为vimindex(名字我随便起的,可以随便改),附执行权限(chmod +x /usr/bin/vimindex)
- #!/bin/sh
- find $(pwd) -name "*.h" -o -name "*.c" -o -name "*.cc" > cscope.files
- cscope -bkq -i cscope.files
- ctags -R
好了,到这里就配置好了,用vimindex生成索引文件开始浏览之旅吧。
本文出自 “ttsky138” 博客,请务必保留此出处http://ttsky138.blog.51cto.com/3282968/641094