2015/12/14

Published 12月 14, 2015 by

Linux VI 及 目錄變更顏色

vi變更顏色:
設定在個人家目錄:
[root@ap811 ~]#cat .bashrc
# .bashrc
alias vi='vim'

##設定套件顏色
[root@ap811 ~]#cat .vimrc
:color desert


目錄變更顏色:
先確認是使用那一個file
[root@ap811 ~]# set | grep DIR
COLORS=/etc/DIR_COLORS.xterm

尋找DIR參數,變更後面的參
vi /etc/DIR_COLORS.xterm
# Below are the color init strings for the basic file types. A color init
# string consists of one or more of the following numeric codes:
# Attribute codes:
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
NORMAL 00       # global default, although everything should be something.
FILE 00         # normal file
DIR 00;33       # directory
…..

若是要設定在個人,設定方式如下:
[schuang@ap811 ~]#cp /etc/DIR_COLORS /userap/schuang/DIR_COLORS

變更DIR欄位顏色
[schuang@ap811 ~]#vi /userap/schuang/DIR_COLORS
DIR 00;33       # directory

登錄自動登錄,新增以下這一段:
[schuang@ap811 ~]#vi .bashrc
eval `dircolors --sh /userap/schuang/DIR_COLORS`