set autoindent
set cindent
set modeline
set ruler
set showcmd
set showfulltag
set showmode
set smartcase
set smartindent
set imcmdline
set previewwindow
set hlsearch
colorscheme desert
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
syntax enable
syntax on
set nu
set ic
set tabstop=4
set softtabstop=4
set shiftwidth=4
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
set autoread
set nobackup
set noswapfile
set confirm "在處理未保存或者只讀文件得時候,彈出確認"
" Source a global configuration file if available
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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"setting cscope ctags
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tags=tags;
set autochdir
if has("cscope")
set csprg=/usr/bin/cscope
set cscopetag " 使支持用 Ctrl+] 和 Ctrl+t 快捷鍵在代碼間跳來跳去
" check cscope for definition of a symbol before checking ctags:
" set to 1 if you want the reverse search order.
set csto=0
" set cscopequickfix=s-,c-,d-,i-,t-,e-
set cst
set nocsverb
" add any cscope database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add the database pointed to by environment variable
elseif $CSCOPE_DB !=""
cs add $CSCOPE_DB
"
else
let cscope_file=findfile("cscope.out",".;")
let cscope_pre=matchstr(cscope_file, ".*/")
if !empty(cscope_file) && filereadable(cscope_file)
exe "cs add" cscope_file cscope_pre." -C"
endif
endif
set csverb
" show msg when any other cscope db added
set cscopeverbose
" cscopetagorder: Option is to find the tag file or to find the cscope database.
" 0: find cscope database. 1: find tag files.
set cscopetagorder=0
endif
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"setting map for cscope
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <C-/>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-/>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-/>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-/>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-/>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-/>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-/>i :cs find i <C-R>=expand("<cfile>")<CR><CR>
nmap <C-/>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
" the new window.
nmap <C-Space>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
nmap <C-Space><C-Space>s
\:vert scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>g
\:vert scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>c
\:vert scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>t
\:vert scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>e
\:vert scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>i
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"setting taglist
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <silent> <F8> :TlistToggle<CR>
"Tlist " 調用TagList
let Tlist_Sort_Type = "name" " 按照名稱排序
let Tlist_Compart_Format = 1 " 壓縮方式
"let Tlist_Show_One_File=0 " 只顯示當前文件的tags
let Tlist_Exit_OnlyWindow=1 " 如果Taglist窗口是最後一個窗口則退出Vim
let Tlist_File_Fold_Auto_Close = 0 " 不要關閉其他文件的tags
let Tlist_Use_Right_Window=1 " 在右側窗口中顯示
let Tlist_File_Fold_Auto_Close=1 " 自動摺疊
map <silent> <leader>tl :TlistToggle<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"setting window resize
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <C-k> <C-w>+
nmap <C-j> <C-w>-
nmap <C-h> <C-w><
nmap <C-l> <C-w>>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 智能補全功能開啓
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype plugin indent on
set completeopt=longest,menu