" 运行模式。
source ~/linux_pro/vim/vimrc
set nocompatible " 非兼容vi模式。
set history=400 " history存储长度。
set autoread " 文件修改之后自动载入。
set mouse-=a " 在所有的模式下面打开鼠标。
set hlsearch " 高亮search命中的文本。
autocmd! bufwritepost _vimrc source % " vimrc文件修改之后自动加载。 windows。
autocmd! bufwritepost .vimrc source % " vimrc文件修改之后自动加载。 linux。
" 取消备份。
set nobackup
set nowb
set noswapfile
" 设置编码。
set encoding=gbk
"set encoding=utf-8
set fileencodings=utf-8,gbk " 设置文件的编码。
set helplang=cn " 设置使用中文的帮助。
set termencoding=gbk
"set termencoding=utf-8
"set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
"set fileencoding=utf-8
"set encoding=utf-8
"set termencoding=utf-8
" 显示设置。
set number " 显示行号。
set guifont=Consolas:h11 " window gui模式下面的字体。
set wrap " 取消换行。
syntax on " 打开语法高亮。
colorscheme darkblue " 深蓝色配色方案。
set t_Co=8 " the color, can be 8, 16, 32, 64 256
au GUIEnter * simalt ~x " windows下面打开最大化。
let php_folding=0 " 打开自动折叠的功能。
" 缩进。
set autoindent " 自动对齐
set cindent " 按照 C 语言的语法,自动地调整缩进的长度
" C/C++语言的具体缩进方式,windows风格
set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
if &term=="xterm"
set t_Co=8
set t_Sb=m
set t_Sf=m
endif
" tab 空格。
set expandtab
set smarttab
set shiftwidth=2
autocmd FileType html,python,vim,javascript setlocal shiftwidth=2
autocmd FileType html,python,vim,javascript setlocal tabstop=2
autocmd FileType java,php setl shiftwidth=4
autocmd FileType java,php setl tabstop=4
" taglist
let Tlist_Auto_Highlight_Tag = 1
let Tlist_Auto_Open = 0
let Tlist_Auto_Update = 1
let Tlist_Close_On_Select = 0
let Tlist_Compact_Format = 0
let Tlist_Display_Prototype = 0
let Tlist_Display_Tag_Scope = 1
let Tlist_Enable_Fold_Column = 0
let Tlist_Exit_OnlyWindow = 0
let Tlist_File_Fold_Auto_Close = 0
let Tlist_GainFocus_On_ToggleOpen = 1
let Tlist_Hightlight_Tag_On_BufEnter = 1
let Tlist_Inc_Winwidth = 0
let Tlist_Max_Submenu_Items = 1
let Tlist_Max_Tag_Length = 30
let Tlist_Process_File_Always = 0
let Tlist_Show_Menu = 0
let Tlist_Show_One_File = 0
let Tlist_Sort_Type = "order"
let Tlist_Use_Horiz_Window = 0
let Tlist_Use_Right_Window = 1
let Tlist_WinWidth = 35
let tlist_php_settings = 'php;c:class;i:interfaces;d:constant;f:function'
" todo and calendar
filetype plugin indent on
let g:calendar_navi= 'right'
let g:calendar_navi_label = '上月,本月,下月'
let g:calendar_mruler = '一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月'
let g:calendar_wruler = '天 一 二 三 四 五 六'
let g:calendar_monday = 1
" 自动关联文件属性。
autocmd BufNewFile,BufRead *.yicf set filetype=yicf
autocmd BufNewFile,BufRead *.conf set filetype=apache
autocmd BufNewFile,BufRead *.vol set filetype=vo_base
autocmd BufNewFile,BufRead *.todo set filetype=vo_base
autocmd BufNewFile,BufRead *.lst set filetype=vo_base
autocmd BufNewFile,BufRead *.tree set filetype=vo_base
" 快捷方式。
map <C-Tab> :bnext<CR>
map <S-Tab> :bp<CR>
map <C-S> :w!<CR>
map <F10> :NERDTreeToggle<CR>
map <F11> :TlistToggle<CR>
" 模板。
autocmd BufNewFile *.php 0r ~/.vim/template/tpl.php
" 加载用户自定义的配置文件。
"source ~/.vim/my.vim
" vim 自动补齐
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
" Python 文件的一般设置,比如不要 tab 等
autocmd FileType python set tabstop=4 shiftwidth=4 expandtab
"自动补全配置
"Enable omni completion. (Ctrl-X Ctrl-O)
"autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType java set omnifunc=javacomplete#Complete
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
" Python 自动补全功能,用 Ctrl-N 调用
"pydiction 1.2 python auto complete
let g:pydiction_location = '~/.vim/tools/pydiction/complete-dict'
"defalut g:pydiction_menu_height == 15
let g:pydiction_menu_height = 20