在用戶主目錄下新建vimrc即可。例如:
vim ~/.vimrc
然后復制進去即可。
配置如下:
"關閉vim一致性原則 set nocompatible "顯示行號 set number "設置在編輯過程中右下角顯示光標的行列信息 set ruler "在狀態欄顯示正在輸入的命令 set showcmd "設置歷史記錄條數 set history=1000 "設置取消備份 禁止臨時文件的生成 set nobackup set noswapfile "設置匹配模式 set showmatch "設置C/C++方式自動對齊 set autoindent set cindent "開啟語法高亮功能 syntax enable syntax on "指定配色方案為256色 set t_Co=256 "設置搜索時忽略大小寫 set ignorecase "配置backspace的工作方式 set backspace=indent,eol,start "設置在vim中可以使用鼠標 set mouse=a "設置tab寬度 set tabstop=4 "設置自動對齊空格數 set shiftwidth=4 "設置退格鍵時可以刪除4個空格 set smarttab set softtabstop=4 "將tab鍵自動轉換為空格 set expandtab "設置編碼方式 set encoding=utf-8 "自動判斷編碼時 依次嘗試以下編碼 set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 "檢測文件類型 filetype on "針對不同的文件采取不同的縮進方式 filetype indent on "允許插件 filetype plugin on "啟動智能補全 filetype plugin indent on
