zshrc
用過prezto與oh-my-zsh的zsh framework以後雖然很方便但是預設會載入一堆插件跟資料,導致開啟shell的時候會有延遲的感覺,尤其進入龐大的git資料夾的時候,速度慢到可以 嘗試自己寫zshrc把會用到的寫進去就好,速度提升不少,git方面採用比較好的做法,先把原本要輸出在Prompt的git訊息輸出到tmp裡面,等跑完以後在資料撈回Prompt 大約如下: setopt prompt_subst # enable command substition in prompt autoload -Uz vcs_info zstyle ':vcs_info:*' enable bzr git hg svn zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' stagedstr '%F{green}●%f' zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f' zstyle ':vcs_info:*' formats ' %b%c%u' zstyle ':vcs_info:*' actionformats " - [%b%c%u|%F{cyan}%a%f]" zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b|%F{cyan}%r%f' zstyle ':vcs_info:git*+set-message:*' hooks git_status ASYNC_PROC=0 ASYNC_DATA="${TMPPREFIX}-prompt_sorin_data" function precmd() { function async() { vcs_info # save to temp file printf "%s" "${vcs_info_msg_0_}" > $ASYNC_DATA # signal parent kill -s USR1 $$ } # do not clear RPROMPT, let it persist # kill child if necessary if [[ "${ASYNC_PROC}" != 0 ]]; then kill -s HUP $ASYNC_PROC >/dev/null 2>&1 || : fi # start background computation async &! ASYNC_PROC=$! } function TRAPUSR1() { # read from temp file RPROMPT="$(cat $ASYNC_DATA)" # reset proc number ASYNC_PROC=0 # redisplay zle && zle reset-prompt } PROMPT='%F{cyan}%n@%m%f %F{green}%~%f # ' RPROMPT='' References ...