#!/bin/bash cd /home/tyson/hxfan if [ -e tags ] then rm -f tags fi if [ -e cscope.files ] then rm -f cscope.files fi if [ -e cscope.out ] then rm -f cscope.out fi ctags -R . find . -name '*.h' -o -name '*.c' -o -name '*.cpp' > cscope.files cscope -b " ========================================================================== " BASIC SETTINGS " -------------- " show the line number on the left side set number " set the length when press tab. set tabstop=4 " set the length when format text. set shiftwidth=2 " expand tab key with 4 space. set expandtab " paste ok set paste " do not compatible with Vi. set nocompatible " show the line number and percentage of current position set ruler " set the default path for find command. " the current folder and recursive folders. set path=.,**, " set the diff option set diffopt=vertical,filler,context:5 " 设置按c语言格式对齐 set cindent " 设置自动换行时缩进4个空格 set shiftwidth=4 " set autochdir set tags=/home/tyson/hxfan/tags; let Tlist_Show_One_File = 1 let Tlist_Exist_OnlyWindow = 1 let Tlist_Use_Right_Window = 1 let Tlist_Sort_Type = "order" let Tlist_WinWidth = 40 let Tlist_GainFocus_On_ToggleOpen = 1 nmap tm :TlistToggle<CR> " set the encoding for windows text format. let &termencoding=&encoding set fileencodings=ucs-bom,utf-8,cp936,gbk,gb18030,chinese,big5,euc-jp,euc-kr,latin1 " set nobackup set writebackup set backupext=.bak filetype plugin on "so $VIMRUNTIME/syntax/sh.vim "so $VIMRUNTIME/syntax/cpp.vim syntax enable syntax on colorscheme desert set wildignore+=*.o,*.a,*.so,*.obj,*.exe,*.lib,*.ncb,*.opt,*.plg,.svn,.git " show status set laststatus=2 " ========================================================================== " FUNCTIONS " -------------- highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue function! CurDir() let curdir = getcwd() return curdir endfunction set statusline=[%n]\ %f\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ command -bang -nargs=? QFix call QFixToggle(<bang>0) function! QFixToggle(forced) if exists("g:qfix_win") && a:forced == 0 cclose unlet g:qfix_win else copen 10 let g:qfix_win = bufnr("$") endif endfunction " ========================================================================== " MAP SETTINGS " -------------- " move among splitted windows noremap <silent> <C-h> <C-w>h noremap <silent> <C-j> <C-w>j noremap <silent> <C-k> <C-w>k noremap <silent> <C-l> <C-w>l " nnoremap <silent> <F1> :so $VIMRUNTIME/syntax/cpp.vim<CR> nnoremap <C-N> :tabnew nnoremap <C-C> :tabclose<CR> nnoremap <C-D> gt " grep command!GTF :execute 'vimgrep '.expand('<cword>').' '.expand('%') | :copen nnoremap <S-F> :GTF<CR> nnoremap <silent> <F2> :QFix<CR> nnoremap <silent> <S-L> :Matrix<CR> nmap wm :NERDTreeToggle<CR> if has("cscope") set cscopequickfix=s-,c-,d-,i-,t-,e- "set csto=0 "set cst "set csverb endif ":cs add ./cscope.out ":cs add /vobs/gsn/product/code/business_specific/gts/cscope.out ":cs add /vobs/gsn/product/code/sgsn-gt/mts/cscope.out nmap wg :cs find g <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap wc :cs find c <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap wt :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR> nmap wf :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR> nmap <F3> :call Do_CsTag()<CR>