LoginSignup
0
1

More than 3 years have passed since last update.

.zshrc だけで作るzsh設定

Posted at

サーバ等でzshを使う際に、余計なものを追加したくない場合に利用している .zshrc です。

# alias
alias ls='ls -F --color=auto'
alias la='ls -laF --color=auto'
alias lah='ls -lahF --color=auto'
alias ga='git add . '
alias gb='git branch '
alias gc='git checkout '
alias gcb='git checkout -b '
alias gs='git status '
alias gl='git log --oneline '

# 色を使用
autoload -Uz colors
colors
# 色の設定
export LSCOLORS=Exfxcxdxbxegedabagacad
# 補完時の色設定
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'

# 補完
autoload -Uz compinit
compinit

# history
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
# 他のターミナルとヒストリーを共有
setopt share_history
# ヒストリーに重複を表示しない
setopt histignorealldups
# ヒストリーに保存するときに余分なスペースを削除する
setopt hist_reduce_blanks
# ヒストリーを呼び出してから実行する間に一旦編集できる状態になる
setopt hist_verify

# prompt
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' stagedstr '%F{yellow}!'
zstyle ':vcs_info:git:*' unstagedstr '%F{red}+'
zstyle ':vcs_info:*' formats ' %F{green}%c%u(%b)%f'
zstyle ':vcs_info:*' actionformats ' (%b|%a)'
precmd () { vcs_info }
PROMPT='%F{yellow}[%*]%f%F{green}%m%f:%F{cyan}%~%f${vcs_info_msg_0_}\$ '
0
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
0
1