1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Gitのための.zshrcの設定

Posted at

きっかけ

パソコンが変わるたびに同じような.zshrcの設定を毎回してるのでメモの意味も込めて。

完成イメージ

実装

まず↓をコピーなりダウンロードなりして、${HOME}/.zsh/git-prompt.shここにおきます。
https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

.zshrc
source ${HOME}/.zsh/git-prompt.sh

GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true 
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUPSTREAM=auto

setopt PROMPT_SUBST ; PS1='[%n %c%F{cyan}$(__git_ps1 " (%s)")%f]\$ '

export PATH=/usr/local/var/nodebrew/current/bin:$PATH

# 補完機能有効にする
autoload -U compinit
compinit -u

# 補完候補に色つける
autoload -U colors
colors
zstyle ':completion:*' list-colors "${LS_COLORS}"

# 単語の入力途中でもTab補完を有効化
setopt complete_in_word
# 補完候補をハイライト
zstyle ':completion:*:default' menu select=1
# キャッシュの利用による補完の高速化
zstyle ':completion::complete:*' use-cache true
# 大文字、小文字を区別せず補完する
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# 補完リストの表示間隔を狭くする
setopt list_packed

かいせつと参考文献

GIT_PS1について
https://ryokwkm2.hatenadiary.jp/entry/2017/09/21/125854

1
1
0

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
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?