set nocompatible
set autowrite
set autoread
set nobackup
set noswapfile
" --- syntax and indent ---
syntax on
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set smartindent
set cindent
set expandtab
set nolinebreak
set showmatch
set wrap
" ---editing setting ---
set backspace=2 "use backspace key to delete in insert mode
" ---encoding---
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb2312,gb18030,big5,euc-jp,euc-kr,latin1
set fileencoding=utf-8
set termencoding=utf-8
" ---fileformat---
set ffs=unix,dos,mac
set ff=unix
colorscheme desert
"set columns=120
set number
" statusline
set laststatus=2
set statusline=%f %m%y[%{&ff}:%{&fenc}]%=%10.( %l,%c%V%) %5.(%P%)
filetype on
filetype plugin on
set mouse=a
"---find and substitute ---
set incsearch
set hlsearch
set ignorecase
set sm
" set colors when column is great than 90
"set textwidth=90
"set wrapmargin=90
"au BufWinEnter * let w:m1=matchadd('Search', '\%<101v.\%>90v', -1)
"au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>100v.+', -1)
"au BufWinLeave * call clearmatches()
"---ctags setting---
set path=.,/usr/include/,/usr/local/include
map <F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
set tags+=~/.vim/tag/cpp
set tags+=~/.vim/tag/google
"---Tlist setting---
let Tlist_Ctags_Cmd='ctags'
let Tlist_Use_Right_Window=0
let Tlist_Show_One_File=1
let Tlist_File_Fold_Auto_Close=0
let Tlist_Exit_OnlyWindow=1
let Tlist_Process_File_Always=1
let Tlist_WinHeight=100
let Tlist_WinWidth=24
let Tlist_Inc_WinWidth=0
"---acp setting---
let g:acp_completeoptPreview = 0
"---omni setting---
" 按下F3自动补全代码,注意该映射语句后不能有其他字符,包括tab;否则按下F3会自动补全一些乱码
imap <F3> <C-X><C-O>
" 按下F2根据头文件内关键字补全
imap <F2> <C-X><C-I>
set completeopt=menu,menuone " 关掉智能补全时的预览窗口
let OmniCpp_MayCompleteDot = 1 " autocomplete with .
let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype in popup window
let OmniCpp_GlobalScopeSearch=1 " enable the global scope search
let OmniCpp_DisplayMode=1 " Class scope completion mode: always show all members
let OmniCpp_DefaultNamespaces=["std","_GLIBCXX_STD"]
let OmniCpp_ShowScopeInAbbr=1 " show scope in abbreviation and remove the last column
let OmniCpp_ShowAccess=1
"---bufexploerr seting---
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitVertical=1 " Split vertically.
let g:bufExplorerSplitVertSize = 40 " Split width
let g:bufExplorerUseCurrentWindow=1 " Open in new window.
autocmd BufWinEnter [Buf List] setl nonumber
"---project setting---
let g:proj_flags="imstFST"
"---WinManager :WMToggle---
let g:winManagerWindowLayout='FileExplorer,BufExplorer|TagList'
let g:winManagerWidth=30
let g:defaultExplorer=0
nmap wm :WMToggle<CR>
"---protobuf---
augroup filetype
au! BufRead,BufNewFile *.proto setfiletype prototype
augroup end