1. 程式人生 > 實用技巧 >ubuntu18.04 vim個性化配置

ubuntu18.04 vim個性化配置

1、新建檔案

在終端執行命令 vi ~/.vimrc

2、在該檔案中新增如下內容

"關閉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

3、儲存退出,然後用vim命令建立新的檔案時,以上的設定就會生效