一、修改偏好設定
打開terminal,左上角終端-》偏好設定,打開如下:
點選“Profiles”——》左側清單中選擇喜歡的樣式——》點選“Default”,如下圖:
修改完得退出終端(command + q),重新打開才能生效

END
二、偏好設定裡設定的字型顔色是指所有的字型的顔色,如果希望不同檔案用不同顔色顯示,需執行以下操作
進入~目錄。 $ cd ~
編輯.bash_profile配置檔案。 $ vim .bash_profile
輸入i(英文輸入狀态下),進入編輯狀态
編輯好,按Ese,然後按:wq(英文輸入狀态),儲存并退出
讓設定生效,輸入 $ source .bash_profile
檢視設定效果 $ ls
PS:我的在運作了$ source .bash_profile,之後,依然沒有改變顯示;
mac跟linux/unix的操作指令同屬一族,很多地方相似,比如都存在:~/.bash_profile
~/.bashrc #這個我沒有找到
mac的預設terminal是zsh,其也有一個對應的檔案 ~/.zshrc,這個檔案是每次打開terminal都會執行的,但前兩者則不然;
但我們一般在前兩者中設定alias(其實在/zshrc中設定也可以)以及檔案夾和目錄顔色設定等,如果要保證設定在每次打開terminal時都會生效,
我們可以在.zshrc中添加source ~/.bashrc或者source ~/.bash_profile
PS:放上我的 ~/.zshrc和~/.bash_profile檔案,如下:
(1)~/.zshrc:
# HomeBrew
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH=/Users/mayl/Library/Python/3.8/bin/:$PATH
export PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #load RVM into a shell session *as a function*
export PS1='%n@%m %1~ %#' #%n 目前使用者的賬号名稱
export LS_OPTIONS='--color=auto' #如果沒有指定,則自動選擇顔色
export CLICOLOR='Yes' #是否輸出顔色
export LSCOLORS='CxfxcxdxbxegedabagGxGx' #指定顔色
#grep
alias grep='grep --color=always'
#ls
alias ll='ls -l'
source ~/.bash_profile
# HomeBrew END
(2)~/.bash_profile
export PATH="/Users/mayl/Library/Python/3.8/bin"
#for color
#export CLICOLOR=1
#黑色背景用以下指令
#export LSCOLORS=GxFxCxDxBxegedabagaced
#export LSCOLORS=GaFaCaDaBaegedabagaced
#白色背景用以下指令
#export LSCOLORS=ExFxBxDxCxegedabagacad
#終端預設顔色 exfxcxdxbxegedabagacad
#下面給出的各個字母代表指代的不同顔色
#a black
#b red
#c green
#d brown
#e blue
#f magenta 洋紅
#g cyan 青色
#h light grey
#A bold black, usually shows up as dark grey 粗體黑色,通常顯示為深灰色
#B bold red
#C bold green
#D bold brown, usually shows up as yellow
#E bold blue
#F bold magenta
#G bold cyan
#H bold light grey; looks like bright white
#x default foreground or background
三、設定vim顔色(vim指令編輯檔案的模式顯示效果)
進入~目錄。 $ cd ~
複制系統的vim配置檔案到使用者目錄 $ cp -r /usr/share/vim/vimrc ~/.vimrc
編輯.vimrc檔案配置我們的vim設定,有很多配置,隻提供目前自己在用的一個配置 $ vim .vimrc
配置好,按Esc,然後輸入:wq(英文輸入狀态)儲存并退出 再輸入 $ vim .vimrc 可以檢視設定效果
PS: 放一下我的~/.vimrc檔案
" Configuration file for vim
set modelines=0 " CVE-2007-2438
" Normally we use vim-extensions. If you want true vi-compatibility
" remove change the following statements
set nocompatible " Use Vim defaults instead of 100% vi compatibility
set backspace=2 " more powerful backspacing
" Don't write backup file if vim is being called by "crontab -e"
au BufWrite /private/tmp/crontab.* set nowritebackup nobackup
" Don't write backup file if vim is being called by "chpass"
au BufWrite /private/etc/pw.* set nowritebackup nobackup
let skip_defaults_vim=1
" 上邊是原來檔案自帶的,下邊是自己添加的
syntax on
" 文法高亮
autocmd InsertLeave * se nocul
autocmd InsertEnter * se cul
" 用淺色高亮目前行
set tabstop=4
" Tab鍵的寬度
set softtabstop=4
set shiftwidth=4
" 統一縮進為4
set number
" 顯示行号
colorscheme pablo
" 設定顔色主題,主題在/usr/share/vim/vim81/colors目錄下
set ruler
" 在編輯過程中,在右下角顯示光标位置的狀态行
set completeopt=preview,menu
" 代碼補全
set scrolloff=3
" 光标移動到buffer的頂部和底部時保持3距離
set statusline=\ %<%F[%1*%M%*%n%R%H]%=\ %y\ %0(%{&fileformat}\ %{&encoding}\ Ln\ %l,\ Col\ %c/%L%)
" 設定在狀态行顯示的資訊
au BufReadPost * if line("'\"") > 0 | if line("'\"") <= line("$") | exe("norm '\"") | else |exe "norm $"| endif | endif
" 設定vim打開檔案時光标在上次退出位置
"auto add pyhton header --start
autocmd BufNewFile *.py 0r ~/.vim/vim_template/vim_pyhton_header
autocmd BufNewFile *.py ks|call FileName()|'s
autocmd BufNewFile *.py ks|call CreatedTime()|'s
fun FileName()
if line("$") > 10
let l = 10 "這裡是字母L 不是數字1
else
let l = line("$")
endif
exe "1," . l . "g/File Name:.*/s/File Name:.*/File Name: " .expand("%")
"最前面是數字1,這裡的File Name: 要和模闆中一緻
endfun
fun CreatedTime()
let l = 10
exe "1," . l . "g/Created Time:.*/s/Created Time:.*/Created Time: " .strftime("%Y-%m-%d %T")
"這裡Create Time: 要和模闆中一緻
"auto add python header --end
"[Vim]建立python檔案自動添加python header
" ~/.vim/vim_template/vim_pyhton_header 需要提前建立好,内容如下:
" #!/usr/bin/python
" #-*- coding:utf-8 -*-
" ############################
" #File Name:
" #Author: mayl
" #Mail: [email protected]
" #Created Time:
autocmd BufWritePost $MYVIMRC source $MYVIMRC
" 讓配置變更立即生效
參考:https://jingyan.baidu.com/article/ce43664948bd093772afd373.html
https://blog.csdn.net/orangleliu/article/details/41902851
生活其實也很簡單,喜歡的就去争取、得到的就珍惜、失去的就忘記。