"中文帮助
"set helplang=cn
set encoding=utf8
"启用鼠标
set mouse=a
"启用行号
set nu
""Cursor组高亮显示,而在可视化模式下,则使用vCursor高亮显示组。
""set guicursor=i:block-iCursor-blinkon0,v:block-vCursor
""In gvim, you can change the cursor to an 'I' when in insert mode with:
""set guicursor=i:ver100-iCursor''
""语法高亮
syntax enable
syntax on
"配色方案
colorscheme desert
"启用taglist
"let Tlist_Show_One_File=1
"let Tlist_Exit_OnlyWindow=1
"雇用winmanager
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>
"配置cscope
"set cscopequickfix=s-,c-,d-,i-,t-,e-
""设置minibufexplorer
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
"grep
"nnoremap <silent> <F3> :Grep<CR>
""打开new-omni-completion
filetype plugin indent on
set completeopt=longest,menu
"SuperTab
""let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType="<C-X><C-O>"
"
"
""pydiction 1.2 python auto complete
filetype plugin on
let g:pydiction_location = '~/.vim/doc/complete-dict'
""defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 20
"
"
""python_fold自动折叠
"set foldmethod=indent
"设置tab键为四个空格
set ts=4
set expandtab
set softtabstop=4
set shiftwidth=4
"启用backspace
set backspace=indent,eol,start
""indent: 如果用了:set indent,:set ai等自动缩进,想用退格键将字段缩进的删掉,必须设置这个选项。否则不响应。
"eol:如果插入模式下在行开头,想通过退格键合并两行,需要设置eol。
""start:要想删除此次插入前的输入,需设置这个。
"自动补全括号开始
:inoremap <S-ENTER> <c-r>=SkipPair()<CR>
:inoremap <S-SPACE> <ESC>la
:inoremap <C-ENTER> <ESC>A;<CR>
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { <c-r>=ClsoeBrace()<CR>
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
:inoremap ' ''<ESC>i
:inoremap " ""<ESC>i
:inoremap ;; <ESC>A;<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
function Semicolon()
"echo getline('.')[col('.')]
if getline('.')[col('.')] == ')'
return "<ESC>A;"
elseif getline('.')[col('.')] == '}'
return "\<ESC>A;"
elseif getline('.')[col('.')] == ']'
return "\<ESC>A;"
else
return ";"
endif
endf
function SkipPair()
if getline('.')[col('.') - 1] == ')'
return "\<ESC>o"
else
normal j
let curline = line('.')
let nxtline = curline
while curline == nxtline
if getline('.')[col('.') - 1] == '}'
normal j
let nxtline = nxtline + 1
let curline = line('.')
continue
else
return "\<ESC>i"
endif
endwhile
return "\<ESC>o"
endif
endf
"function ClsoeBrace()
" if getline('.')[col('.') - 2] == '='
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 3] == '='
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 1] == '{'
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 2] == '{'
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 2] == ','
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 3] == ','
" return "{}\<ESC>i"
" else
" return "{\<ENTER>}\<ESC>O"
" endif
"endf
"自补全括号结束
"光标变为竖线的开始
"光标变为竖线的结束
"自动补全CSS,自动实例html
:set omnifunc=csscomplete#CompleteCSS
:set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"符号匹配颜色
:hi MatchParen ctermbg=blue ctermfg=white
if has("autocmd")
au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
endif
"光标颜色方案
let color_normal = 'HotPink'
let color_insert = 'RoyalBlue1'
let color_exit = 'green'
if &term =~ 'xterm\|rxvt'
exe 'silent !echo -ne "\e]12;"' . shellescape(color_normal, 1) . '"\007"'
let &t_SI="\e]12;" . color_insert . "\007"
let &t_EI="\e]12;" . color_normal . "\007"
exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . shellescape(color_exit, 1) . '"\007"'
elseif &term =~ "screen"
if !exists('$SUDO_UID')
if exists('$TMUX')
exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . shellescape(color_normal, 1) . '"\007\033\\"'
let &t_SI="\033Ptmux;\033\e]12;" . color_insert . "\007\033\\"
let &t_EI="\033Ptmux;\033\e]12;" . color_normal . "\007\033\\"
exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . shellescape(color_exit, 1) . '"\007\033\\"'
else
exe 'silent !echo -ne "\033P\e]12;"' . shellescape(color_normal, 1) . '"\007\033\\"'
let &t_SI="\033P\e]12;" . color_insert . "\007\033\\"
let &t_EI="\033P\e]12;" . color_normal . "\007\033\\"
exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . shellescape(color_exit, 1) . '"\007\033\\"'
endif
endif
endif
unlet color_normal
unlet color_insert
unlet color_exit
"set helplang=cn
set encoding=utf8
"启用鼠标
set mouse=a
"启用行号
set nu
""Cursor组高亮显示,而在可视化模式下,则使用vCursor高亮显示组。
""set guicursor=i:block-iCursor-blinkon0,v:block-vCursor
""In gvim, you can change the cursor to an 'I' when in insert mode with:
""set guicursor=i:ver100-iCursor''
""语法高亮
syntax enable
syntax on
"配色方案
colorscheme desert
"启用taglist
"let Tlist_Show_One_File=1
"let Tlist_Exit_OnlyWindow=1
"雇用winmanager
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>
"配置cscope
"set cscopequickfix=s-,c-,d-,i-,t-,e-
""设置minibufexplorer
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
"grep
"nnoremap <silent> <F3> :Grep<CR>
""打开new-omni-completion
filetype plugin indent on
set completeopt=longest,menu
"SuperTab
""let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType="<C-X><C-O>"
"
"
""pydiction 1.2 python auto complete
filetype plugin on
let g:pydiction_location = '~/.vim/doc/complete-dict'
""defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 20
"
"
""python_fold自动折叠
"set foldmethod=indent
"设置tab键为四个空格
set ts=4
set expandtab
set softtabstop=4
set shiftwidth=4
"启用backspace
set backspace=indent,eol,start
""indent: 如果用了:set indent,:set ai等自动缩进,想用退格键将字段缩进的删掉,必须设置这个选项。否则不响应。
"eol:如果插入模式下在行开头,想通过退格键合并两行,需要设置eol。
""start:要想删除此次插入前的输入,需设置这个。
"自动补全括号开始
:inoremap <S-ENTER> <c-r>=SkipPair()<CR>
:inoremap <S-SPACE> <ESC>la
:inoremap <C-ENTER> <ESC>A;<CR>
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
":inoremap { <c-r>=ClsoeBrace()<CR>
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
:inoremap ' ''<ESC>i
:inoremap " ""<ESC>i
:inoremap ;; <ESC>A;<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
function Semicolon()
"echo getline('.')[col('.')]
if getline('.')[col('.')] == ')'
return "<ESC>A;"
elseif getline('.')[col('.')] == '}'
return "\<ESC>A;"
elseif getline('.')[col('.')] == ']'
return "\<ESC>A;"
else
return ";"
endif
endf
function SkipPair()
if getline('.')[col('.') - 1] == ')'
return "\<ESC>o"
else
normal j
let curline = line('.')
let nxtline = curline
while curline == nxtline
if getline('.')[col('.') - 1] == '}'
normal j
let nxtline = nxtline + 1
let curline = line('.')
continue
else
return "\<ESC>i"
endif
endwhile
return "\<ESC>o"
endif
endf
"function ClsoeBrace()
" if getline('.')[col('.') - 2] == '='
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 3] == '='
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 1] == '{'
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 2] == '{'
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 2] == ','
" return "{}\<ESC>i"
" elseif getline('.')[col('.') - 3] == ','
" return "{}\<ESC>i"
" else
" return "{\<ENTER>}\<ESC>O"
" endif
"endf
"自补全括号结束
"光标变为竖线的开始
"光标变为竖线的结束
"自动补全CSS,自动实例html
:set omnifunc=csscomplete#CompleteCSS
:set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"符号匹配颜色
:hi MatchParen ctermbg=blue ctermfg=white
if has("autocmd")
au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"
au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"
endif
"光标颜色方案
let color_normal = 'HotPink'
let color_insert = 'RoyalBlue1'
let color_exit = 'green'
if &term =~ 'xterm\|rxvt'
exe 'silent !echo -ne "\e]12;"' . shellescape(color_normal, 1) . '"\007"'
let &t_SI="\e]12;" . color_insert . "\007"
let &t_EI="\e]12;" . color_normal . "\007"
exe 'autocmd VimLeave * :!echo -ne "\e]12;"' . shellescape(color_exit, 1) . '"\007"'
elseif &term =~ "screen"
if !exists('$SUDO_UID')
if exists('$TMUX')
exe 'silent !echo -ne "\033Ptmux;\033\e]12;"' . shellescape(color_normal, 1) . '"\007\033\\"'
let &t_SI="\033Ptmux;\033\e]12;" . color_insert . "\007\033\\"
let &t_EI="\033Ptmux;\033\e]12;" . color_normal . "\007\033\\"
exe 'autocmd VimLeave * :!echo -ne "\033Ptmux;\033\e]12;"' . shellescape(color_exit, 1) . '"\007\033\\"'
else
exe 'silent !echo -ne "\033P\e]12;"' . shellescape(color_normal, 1) . '"\007\033\\"'
let &t_SI="\033P\e]12;" . color_insert . "\007\033\\"
let &t_EI="\033P\e]12;" . color_normal . "\007\033\\"
exe 'autocmd VimLeave * :!echo -ne "\033P\e]12;"' . shellescape(color_exit, 1) . '"\007\033\\"'
endif
endif
endif
unlet color_normal
unlet color_insert
unlet color_exit