From adb3537c6ea60519fdee970ce5309b810212e3ca Mon Sep 17 00:00:00 2001 From: Kohei Watanabe Date: Tue, 8 Aug 2023 21:51:52 +0900 Subject: [PATCH] add .zshrc --- .bashrc | 3 +-- .zsh/functions/_git | 1 + .zshrc | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 120000 .zsh/functions/_git create mode 100644 .zshrc diff --git a/.bashrc b/.bashrc index adfe8fb..3e55fca 100644 --- a/.bashrc +++ b/.bashrc @@ -5,8 +5,7 @@ HISTCONTROL=ignoreboth:erasedups HISTFILESIZE=$((0x7fffffff)) HISTSIZE=$((0x7fffffff)) PROMPT_COMMAND='[[ $_PWD == $PWD ]] || { _PWD=$PWD; ls; }' -PS1=$PS1'\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -PS1=${PS1%'\$ '}'$(__git_ps1 " \[\033[32m\](%s)\[\033[00m\]")\n\$ ' +PS1=$PS1'\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(__git_ps1 "\[\033[32m\](%s)\[\033[00m\]")\n\$ ' alias ..='cd ..' alias cp='cp --reflink=auto' alias diff='diff --color=auto' diff --git a/.zsh/functions/_git b/.zsh/functions/_git new file mode 120000 index 0000000..4755cbb --- /dev/null +++ b/.zsh/functions/_git @@ -0,0 +1 @@ +/Library/Developer/CommandLineTools/usr/share/git-core/git-completion.zsh \ No newline at end of file diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..19fd996 --- /dev/null +++ b/.zshrc @@ -0,0 +1,19 @@ +. /Library/Developer/CommandLineTools/usr/share/git-core/git-prompt.sh +zstyle ':completion:*:*:git:*' script /Library/Developer/CommandLineTools/usr/share/git-core/git-completion.bash +fpath=(~/.zsh/functions $fpath) +autoload -Uz compinit && compinit +alias ..='cd ..' +alias cp='cp --reflink=auto' +alias diff='diff --color=auto' +alias grep='grep --color=auto' +alias ll='ls -alF' +alias ls='ls --color=auto' +precmd() { + [[ "$TERM" == xterm-256color ]] && print -Pn -- '\e]2;%n@%m %~\a' + [[ "$_PWD" == "$PWD" ]] && return + _PWD="$PWD" + ls +} +setopt PROMPT_SUBST +PROMPT='%B%F{green}%n@%m%f%b:%B%F{blue}%~%f%b $(__git_ps1 "%%F{green}(%s)%%f") +%# '