2010年7月26日 星期一

[OSX 10.6]The Note! Cont.

接續上一篇

進入 fish_prompt.fish
> sudo vim fish_prompt.fish
fish_prompt.fish裡面描述了不同user登入以後prompt的長相。
預設上是"(user)@(hostname)(prompt_pwd)>"這樣一串。
P.S.只是prompt_pwd是縮短以後的pwd。

[增加顏色]
使用 set -l ooxx (set_color color) 增加區域色彩變數
顏色設定的方式基本上就是直接用%s輸出給printf

[換行]
在printf後面的'ooxx'加入 \n

[縮減user/hostname]
使用whoami或hostname,後面再接上 | cut -c 1-n

[顯示時間日期]
直接在prontf後面的參數中呼叫 date "+format"



我目前的設定
set -l _clrB (set_color blue)
set -l _clrC (set_color white)
set -l _clrR (set_color red)
set -l _clrY (set_color yellow)
printf '\n%s%s%s[' "$_clrR" (whoami|cut -c 1-3) "$_clrY"
printf '%s%s%s]%s[' "$_clrC" (date "+%H:%M") "$_clrY" "$_clrB"
printf '%s%s%s]%s' "$__fish_prompt_cwd" (prompt_pwd) "$_clrB" "$__fish_prompt_normal"
printf '\n> '
結果如下

P.S.色彩設定方面的補完就期待godfat來分享一下了 :)

沒有留言:

張貼留言