ทำให้ terminal/iTerm2 มี emoji ขึ้น random + syntax hi-light
ลง Oh my zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
จะเห็นว่า มี security warning
Insecure completion-dependent directories detected:
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.…
แก้ไขตามที่เขาแนะนำเพื่อความปลอดภัย
ปลอดภัยแล้ว โหลดไฟล์ .zshrc อีกสักรอบ
source ~/.zshrc
คราวนี้จะไม่เห็น warning แล้วค่ะ
ลง plugin ที่ ทำ hi-light syntax กัน
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
เปิดใช้งาน plugin ใน file .zshrc
โดยเราจะเพิ่ม zsh-syntax-highlighting
เข้าไปใน plugins list
plugins=( [plugins ต่าง ๆ ...] zsh-syntax-highlighting)
ขั้นตอนโดยละเอียดนะคะ
1. เปิด .zshrc
ด้วย vim
ไฟล์จะใหญ่ ใช้วิธีค้นหาคำว่า plugin เลยละกัน
vim .zshrc
ปุ๊บ ก็พิมพ์ /
ตามด้วยคำที่จะค้นหา คือ plugin
vim จะรอรับ command อยู่บรรทัดล่างสุดนะคะ ดูในรูปก็ได้
พอกด enter มันก็จะพาเราไป ที่ๆ มีคำว่า plugin ที่แรก
ซึ่งจะอยู่ใกล้ ๆ กัน กับ ตำแหน่งที่เราจะ enable plugin ที่ชื่อ zsh-syntax-highlighting
เราต้องกดตัว i บนคีย์บอร์ด เพื่อบอกให้ vim เข้า edit mode ดูรูปถัดไปโน้นนะคะ
พอเสร็จแล้ว กด ESC เอสะเคป 1 ที เพื่อออกจาก edit mode
ตอนนี้ vim ยังไม่ save ให้นะคะ
จะเซฟแล้วออก ให้ พิมพ์ :wq
แล้ว enter
vim จะ save ตามคำสั่ง w ซึ่งย่อจาก write แล้ว quit ตามคำสั่ง q
จากนั้น load .zshrc
อีกรอบ
source .zshrc
คราวนี้ลองเอาคำสั่ง อะไรก็ได้มาใส่ shell ของเราก็จะทำ syntax hi-light ให้แล้ว
ลงธีม ที่ทำให้ Prompt เป็น emoji กันเถอะ!
ต้องขอบคุณ คุณ Stefan Judis ที่ทำ theme และแบ่งปันให้เราได้ใช้กัน
ดาวน์โหลด file ธีม ของเค้ามาค่ะ
https://github.com/stefanjudis/dotfiles
จริง ๆ เราจะใช้แค่ file ที่ชื่อ https://github.com/stefanjudis/dotfiles/blob/primary/config/oh-my-zsh/stefanjudis.zsh-theme
copy config/stefanjudis.zsh-theme
ไปไว้ที่ theme
folder ของ oh-my-zsh
จากนั้นก็จะ enable theme โดยการเปิดไฟล์ .zshrc
ขึ้นมา
ค้นหาคำว่า theme แล้ว edit
หลัง จาก save และปิด ด้วยคำสั่ง :wq
แล้ว
reload config ด้วย source .zshrc
ก็จะเห็น ธีมใหม่แล้วค่ะ
ซึ่งมีผลกับ Terminal ได้ด้วยนะ
ดูสิ random emoji ทุกครั้งเลย น่ารักอ่า