" 插入括號時,短暫地跳轉到匹配的對應括號
set showmatch
" 使用 murphy 調色板
" set nocompatible
" 偵測文件類型
filetype on
" 設定文件瀏覽器目錄爲當前目錄
set bsdir=buffer
set autochdir
" 設置文件編碼
set fenc=utf-8
" 設置文件編碼檢測類型及支持格式
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
" 指定菜單語言
set langmenu=zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" 設置語法高亮度
set syn=cpp
"顯示行號
set nu!
" 查找結果高亮度顯示
set hlsearch
" tab寬度
set tabstop=4
set cindent shiftwidth=4
set autoindent shiftwidth=4
" C/C++註釋
set comments=://
" 修正自動C式樣註釋功能 <2005/07/16>
set comments=s1:
autocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100
autocmd Filetype html,xml,xsl source $VIMRUNTIME/plugin/closetag.vim
autocmd BufReadPost *
if line("'"") > 0 && line("'"") <= line("$") |
exe "normal g`"" |
endif
endif " has("autocmd")
" F5編譯和運行C程序,F6編譯和運行C++程序
" 請注意,下述代碼在windows下使用會報錯
" 須要去掉./這兩個字符
" C的編譯和運行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
" C++的編譯和運行
map <F6> :call CompileRunGpp()<CR>
func! CompileRunGpp()
exec "w"
exec "!g++ % -o %<"
exec "! ./%<"
endfunc
" 可以漂亮地顯示.NFO文件
set encoding=utf-8
function! SetFileEncodings(encodings)
let b:myfileencodingsbak=&fileencodings
let &fileencodings=a:encodings
endfunction
function! RestoreFileEncodings()
let &fileencodings=b:myfileencodingsbak
unlet b:myfileencodingsbak
endfunction
au BufReadPre *.nfo call SetFileEncodings('cp437')|set ambiwidth=single
au BufReadPost *.nfo call RestoreFileEncodings()
" 高亮顯示普通txt文件(須要txt.vim腳本)
au BufRead,BufNewFile *
" 用空格鍵來開關摺疊
set foldenable
set foldmethod=manual
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" minibufexpl插件的通常設置
let g:miniBufExplMapWindowNavV
let g:miniBufExplMapWindowNavA
let g:miniBufExplMapCTabSwitch
let g:miniBufExplModSelTarget = 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
我設置的.vimrc
dfd"set number
"set cursorline
syntax on
set hlsearch
"set smartindent
" 使用C樣式的縮進
set cindent
" 製表符爲4
set tabstop=4
" 統一縮進爲4
set softtabstop=4
set shiftwidth=4
" C的編譯和運行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
" C++的編譯和運行
map <F6> :call CompileRunGpp()<CR>
func! CompileRunGpp()
exec "w"
exec "!g++ % -o %<"
exec "! ./%<"
endfunc
php