VI 字體高亮顯示 自動縮進的設置 TAB 4格

其實主要是vi本身是不帶顏色的,vim帶顏色

用命令:alias vi=vim

就OK了。

以後vi就帶顏色了。

syntax on “語法高亮顯示

filetype indent on “文件自動縮進

set showcmd ” Show (partial) command in status line.

set showmatch ” Show matching brackets.

set incsearch ” Incremental search

set mouse=a ” Enable mouse usage (all modes) in terminals

set syn=cpp “語法高亮

set nu! “顯示行號

set hlsearch

set nobackup “不產生備份文件

set ruler “在編輯過程中,在右下角顯示光標位置的狀態行

colorscheme evening “設置配色方案

set autoindent “使用自動對其,也就是把當前行的對其格式應用到下一行
set smartindent “依據上面的對其格式,智能的選擇對其方式

set tabstop=4 “設置tab鍵爲4個空格
set shiftwidth=4 “設置當前行之間交錯時使用4個空格

set enc=utf-8 “設置編碼
set fenc=utf-8 “設置文件編碼
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 “設置文件編碼檢測類型及支持格式
set langmenu=zh_CN.UTF-8 “指定菜單語言

set helplang=cn “中文幫助

 

 

注:如果發先VI中不顯示字體顏色,可能是   syntax on //語法高亮顯示     這句被註釋掉了

 

2、自動縮進

在文件末尾添加一行,輸入  set autoindent
在添加一行,輸入         set cindent
其中 autoindent 是自動縮進; cindent是特別針對 C語言語法自動縮進

注意:如果設置好以上設置後,VIM沒有作出相應的動作,那麼請你把你的VIM升級到最新版,一般只要在終端輸入以下命令即可:sudo apt-get install vim

 

3、TAB縮進間距

在文件尾輸入:

              set number

              set tabstop=4

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章