macOS 修改终端 Terminal 的配色
作者:互联网
Mac OS 修改终端配色方案
Terminal默认的显示效果是白底黑字,而且字体极小,看着特别费劲。不同于Linux下有配色的命令行,在 Mac 中各种文件都是同一个颜色,连文件和目录都不方便区分,因此需要对其进行修改配色方案。
本方案的最终效果和 Ubuntu 的终端类似。
1. Terminal主题设置
新建 Pro1.terminal 文件,vim Pro1.terminal,写入以下内容并保存。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBww
LjE1MTA2NDUxMDIgMC4xNTEwNjQ1MTAyIDEAEAKAAtIQERITWiRjbGFzc25hbWVYJGNs
YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290
gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAAAA
AAAAAAAAAM4=
</data>
<key>ANSIBrightBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEBww
LjIwMjA1MTM1MjMgMC4yMDIwNTEzNTIzIDEAEAGAAtIQERITWiRjbGFzc25hbWVYJGNs
YXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290
gAEIERojLTI3O0FITltigYOFipWepqmyxMfMAAAAAAAAAQEAAAAAAAAAGQAAAAAAAA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29sb3KiEhRYTlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9v
dIABCBEaIy0yNztBSE5bYoKEhouWn6eqs8XIzQAAAAAAAAEBAAAAAAAAABkAAAAAAAAA
AAAAAAAAAADP
</data>
<key>CursorType</key>
<integer>0</integer>
<key>Font</key>
<data>
YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QVk5TU2l6ZVhOU2ZGbGFnc1ZOU05hbWVWJGNs
YXNzI0AwAAAAAAAAEBCAAoADXU1lbmxvLVJlZ3VsYXLSExQVFlokY2xhc3NuYW1lWCRj
bGFzc2VzVk5TRm9udKIVF1hOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEaG1Ryb290
gAEIERojLTI3PEJLUltiaXJ0dniGi5afpqmyxMfMAAAAAAAAAQEAAAAAAAAAHAAAAAAA
AAAAAAAAAAAAAM4=
</data>
<key>FontAntialias</key>
<true/>
<key>FontWidthSpacing</key>
<real>0.99596774193548387</real>
<key>ProfileCurrentVersion</key>
<real>2.0499999999999998</real>
<key>SelectionColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc0sw
LjI1NDAzMjI1ABADgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRY
TlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztBSFBdZHBy
dHmEjZWYobO2uwAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC9
</data>
<key>ShowWindowSettingsNameInTitle</key>
<false/>
<key>TextBoldColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc0Ix
ABADgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRYTlNPYmplY3Rf
EA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztBSFBdZGdpa3B7hIyPmKqt
sgAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC0
</data>
<key>TextColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OV05TV2hpdGVcTlNDb2xvclNwYWNlViRjbGFzc0sw
Ljk0NzU4MDY0ABADgALSEBESE1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29sb3KiEhRY
TlNPYmplY3RfEA9OU0tleWVkQXJjaGl2ZXLRFxhUcm9vdIABCBEaIy0yNztBSFBdZHBy
dHmEjZWYobO2uwAAAAAAAAEBAAAAAAAAABkAAAAAAAAAAAAAAAAAAAC9
</data>
<key>UseBoldFonts</key>
<false/>
<key>UseBrightBold</key>
<true/>
<key>name</key>
<string>Pro</string>
<key>shellExitAction</key>
<integer>2</integer>
<key>type</key>
<string>Window Settings</string>
</dict>
</plist>
双击运行 Pro1.terminal 文件,即可看到新的终端样式,然后在终端的偏好设置中把 Pro1 终端设置为默认,如下图所示。
2. 不同文件类型颜色设置
vim ~/.bash_profile
写入(如果原本有内容,那就添加到末尾) 以下内容:
alias ll='ls -la' # 命令别名
#export LS_OPTIONS='--color=auto' # 如果没有指定,则自动选择颜色
export CLICOLOR='Yes' # 是否输出颜色
export LSCOLORS='ExGxFxdaCxDaDahbadacec' # 指定颜色
export PS1="\[\033[01;31;01m\][\u@\h \W]\$\[\033[01;00;00m\] " # 指定命令行提示符的颜色为红色
这里完全沿用了Linux的配色方案,即蓝色表示文件夹,白色表示普通文件,绿色表示可执行文件,青色表示链接文件等。
关闭当前Terminal,重启一个新的Terminal使配置生效。效果如下:
![image-20220319134806400](/Users/zengfeng/Library/Application Support/typora-user-images/image-20220319134806400.png)
3. vim显示效果设置
cp /usr/share/vim/vimrc ~/.vimrc
vim ~/.vimrc
在文件末尾添加如下代码:
colorscheme default " 设置颜色主题
syntax on " 语法高亮
filetype on " 检测文件的类型
set number " 显示行号
set cursorline " 用浅色高亮当前行
"autocmd InsertLeave * se nocul
"autocmd InsertEnter * se cul
set ruler " 在编辑过程中,在右下角显示光标位置的状态行
set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏)
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ %c:%l/%L%)\
" 设置在状态行显示的信息
set tabstop=4 " Tab键的宽度
set softtabstop=4
set shiftwidth=4 " 统一缩进为4
set autoindent " vim使用自动对齐,也就是把当前行的对齐格式应用到下一行(自动缩进)
set cindent " (cindent是特别针对 C语言语法自动缩进)
set smartindent " 依据上面的对齐格式,智能的选择对齐方式,对于类似C语言编写上有用
set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
set incsearch " 输入搜索内容时就显示搜索结果
set hlsearch " 搜索时高亮显示被找到的文本
set foldmethod=indent " 设置缩进折叠
set foldlevel=99 " 设置折叠层数
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo')<CR>
" 用空格键来开关折叠
" 自动跳转到上次退出的位置
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
保存退出,重新进入 vim 即可看到效果,如下图所示:
![image-20220319135233503](/Users/zengfeng/Library/Application Support/typora-user-images/image-20220319135233503.png)
4. 为常用命令设置别名
vim ~/.bash_profile
添加:
alias ll='ls -la'
保存生效:
source ~/.bash_profile
标签:文件,macOS,set,配色,vim,Terminal,YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGF 来源: https://www.cnblogs.com/FengZeng666/p/16026268.html