my vimrc

来源:互联网 发布:北京seo短期培训 编辑:程序博客网 时间:2024/05/01 11:01

set helplang=cn
set guioptions-=r
set guioptions -=T
syntax enable
syntax on
set cursorline
set nobackup
set noswapfile
set wildmenu
colorscheme torte
set hls
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1


map <C-w><C-f> :FirstExplorerWindow<cr>

map <C-w><C-b> :BottomExplorerWindow<cr>
map <C-w><C-t> :WMToggle<cr> 

set cscopequickfix=s-,c-,d-,i-,t-,e- 


set shortmess =I

set nu 

let g:miniBufExplMapWindowNavVim = 1   


set autowrite

nnoremap <silent> <F4> :Grep<CR> 


set tabstop=4

set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
set cinoptions={0,1s,t0,n-2,(03s,=.5s,>1s:1s

if &term=="xterm"

set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif

set nocp

filetype plugin  on
set tags+=/home/hjs-wcl/programe/tags
set tags+=/home/hjs-wcl/c++/programe/tags
set tags+=/home/hjs-wcl/.vim/tags/cpp
let OmniCpp_GlobalScopeSearch =1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameter
let OmniCpp_MayCompleteDot = 1 " autocomplete after
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menu,longest




if has("autocmd")

autocmd FileType c,cpp inoremap ( ()<esc>:let leavechar=")"<cr>i
endif


map <F3> :silent! Tlist<CR>


let Tlist_Use_Right_Window=0

let Tlist_Show_One_File=0
let Tlist_File_Fold_Auto_Close=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Process_File_Always=0
let Tlist_Inc_Winwidth=0
let winManagerWindowLayout = 'FileExplorer | TagList'

"Tree explorer配置

let treeExplVertical = 1
let treeExplWinsize = 30

let g:SuperTabRetainCompletionType=2

let g:SuperTabDefaultCompletionType="<C-N>"
let b:current_syntax = "go"



nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>:copen<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>:copen<CR>
nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>:copen<CR>
nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>:copen<CR>
nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>:copen<CR>
nmap <C-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>:copen<CR>


autocmd FileType python set omnifunc=pythoncomplete#Complete

autocmd FileType javascript set omnifunc=javascrīptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete



map   <silent> <F5>        :copen<CR>

map   <silent> <F6>        :cclose<CR>
map   <silent> <F7>        :cp<CR>
map   <silent> <F8>        :cn<CR>


imap  <silent> <F5>   <Esc>:copen<CR>

imap  <silent> <F6>   <Esc>:cclose<CR>
imap  <silent> <F7>   <Esc>:cp<CR>
imap  <silent> <F8>   <Esc>:cn<CR>


map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>



map <F12> :call Do_CsTag()

function Do_CsTag()
let dir = getcwd()
if filereadable("tags")
let tagsdeleted=delete("./"."tags")
if(tagsdeleted!=0)
echohl WarningMsg | echo "Fail to do tags! I cannot delete the tags" | echohl None
return
endif
endif
if has("cscope")
silent! execute "cs kill -1"
endif
if filereadable("cscope.files")
let csfilesdeleted=delete("./"."cscope.files")
if(csfilesdeleted!=0)
echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.files" | echohl None
return
endif
endif
if filereadable("cscope.out")
let csoutdeleted=delete("./"."cscope.out")
if(csoutdeleted!=0)
echohl WarningMsg | echo "Fail to do cscope! I cannot delete the cscope.out" | echohl None
return
endif
endif
if(executable('ctags'))
"silent! execute "!ctags -R --c-types=+p --fields=+S *"
silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."
endif
if(executable('cscope') && has("cscope") )
silent! execute "!find . -name '*.h' -o -name '*.c' -o -name '*.cpp' -o -name '*.java' -o -name '*.cs' > cscope.files"
silent! execute "!cscope -b"
execute "normal :"
if filereadable("cscope.out")
execute "cs add cscope.out"
endif
endif
endfunction


"自定义快捷键

inoremap <C-O> <C-X><C-O>
inoremap <C-L> <C-X><C-L>
inoremap <C-K> <C-X><C-K>
inoremap <C-F> <C-X><C-F>
inoremap <Q> <C-N>

原创粉丝点击