整理下我的VIM配置檔案

以下是我個人使用的VIM配置檔案內容,記錄在這裡,方便日後查閱。

"開啟語法高亮
syntax on
set t_Co=256
"開啟檔案型別檢測功能
filetype on
"不同檔案型別採用不同縮排
filetype indent on
"允許使用外掛
filetype plugin on
filetype plugin indent on
"關閉vi模式
set nocp
"與windows共享剪貼簿
set clipboard+=unnamed
"取消VI相容,VI鍵盤模式不易用
set nocompatible
"顯示行號, 或set number
set nu
"歷史命令儲存行數
set history=100
"當檔案被外部改變時自動讀取
set autoread
"取消自動備份及產生swp檔案
set nobackup
set nowb
set noswapfile
"允許使用滑鼠點選定位
set mouse=a
"允許區域選擇
set selection=exclusive
set selectmode=mouse,key
"高亮游標所在行
set cursorline
"取消游標閃爍
set novisualbell
"總是顯示狀態行
set laststatus=2
"狀態列顯示當前執行的命令
set showcmd
"標尺功能,顯示當前游標所在行列號
set ruler
"貼上時保持格式
set paste
"高亮顯示匹配的括號
set showmatch
"在搜尋的時候忽略大小寫
set ignorecase
"高亮被搜尋的句子
set hlsearch
"在搜尋時,輸入的詞句的逐字元高亮(類似firefox的搜尋)
set incsearch
"繼承前一行的縮排方式,特別適用於多行註釋
set autoindent
"為C程式提供自動縮排
set smartindent
"使用C樣式的縮排
set cindent
"製表符為4
set tabstop=4
set expandtab
"%retab!
"統一縮排為4
set softtabstop=4
set shiftwidth=4
"允許使用退格鍵,或set backspace=2
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
"取消換行
set nowrap
"啟動的時候不顯示那個援助索馬利亞兒童的提示
set shortmess=atI
"在被分割的視窗間顯示空白,便於閱讀
set fillchars=vert:\ ,stl:\ ,stlnc:\
"游標移動到buffer的頂部和底部時保持3行距離, 或set so=3
set scrolloff=3
"設定預設解碼
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
"設定字型
set guifont=Courier_New:h11:cANSI
set guifontwide=新宋體:h11:cGB2312
"設定編碼
set enc=utf-8
set fileencodings=ucs-bom,utf-8,chinese
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"自動補全
filetype plugin indent on
set completeopt=longest,menu
"自動補全命令時候使用選單式匹配列表
set wildmenu
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha Code