LoginSignup
68

More than 5 years have passed since last update.

posted at

updated at

hubコマンドを利用&&プロンプトにgitのブランチ等を表示している人向けのzsh高速化

branchname=`git symbolic-ref --short HEAD 2> /dev/null`

のようにprecmd内でブランチ名を取得してプロンプトに表示,ということをやっている人は多いと思うけど,hubコマンドを使っていて以下のような設定をしていると毎回hubが呼ばれてしまい,結構重くなる.

function git(){hub "$@"}

そのためprecmd内ではhubを呼ばずにgitそのものを呼ぶようにするとプロンプトの表示がかなり早くなる.

local git==git
branchname=`${git} symbolic-ref --short HEAD 2> /dev/null`
# command git

パスをベタ書きしているのが嫌だけどかなり早くなった.
→コメントより,git==gitもしくはcommand gitでokとのこと.git==gitは見た目気持ち悪いけど…

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
68