MacOS で zsh を使うことを想定して .zprofile / .zshrc を取り急ぎ書いてみた
スーパー雑だけど取り急ぎ。
# Ctrl+U でカーソル以降を削除しない bindkey \^U backward-kill-line # Home/End/Delキーを意図した動作に変更 bindkey "^[[3~" delete-char bindkey "^[[1~" beginning-of-line bindkey "^[[4~" end-of-line GIT_PS1_SHOWDIRTYSTATE=true GIT_PS1_SHOWUNTRACKEDFILES=true GIT_PS1_SHOWSTASHSTATE=true GIT_PS1_SHOWUPSTREAM=auto # PS1~n # https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh source ~/.git-prompt.sh autoload -Uz colors if [ $UID -eq 0 ];then # root(git-ps1無し + 色を変える) setopt PROMPT_SUBST ; PS1='%F{yellow}[%*%f %F{green}%n@%m%f%F{red}:%!%f %F{blue}%.%f%F{yellow}]%B%#%b%f ' else # other setopt PROMPT_SUBST ; PS1='%F{red}[%*%f %F{green}%n@%m%f%F{red}:%!%f %F{blue}%.%f%F{cyan}$(__git_ps1 "(%s)")%f%F{red}]%B%#%b%f ' fi # 補完機能 autoload -Uz compinit && compinit # Case-insensitiveな補完(zshで.inputrcは効かない) zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # コマンド履歴 HISTFILE=~/.zsh_history HISTSIZE=6000000 SAVEHIST=6000000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data # コマンド履歴検索 autoload history-search-end zle -N history-beginning-search-backward-end history-search-end zle -N history-beginning-search-forward-end history-search-end bindkey "^P" history-beginning-search-backward-end bindkey "^N" history-beginning-search-forward-end # Screen session export SCREENDIR=$HOME/.screen # Get the aliases and functions if [ -f ~/.zshrc ]; then . ~/.zshrc fi # bash履歴即時反映 # export PROMPT_COMMAND="history -a" export PROMPT_COMMAND='history -a; history -r' # (以下省略)
.bashrc / .zshrc には alias くらいしか書かない派なので省略。
ちなみに昔からPS1にはこだわりがあって、その見た目はこんな感じ。