Skip to content

Commit

Permalink
use starship
Browse files Browse the repository at this point in the history
  • Loading branch information
Matsui Masashi committed Mar 18, 2020
1 parent a0a10c7 commit 1182f83
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 63 deletions.
1 change: 1 addition & 0 deletions .bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ fi

export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
eval "$(starship init bash)"
50 changes: 0 additions & 50 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -1,53 +1,3 @@
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}

# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}

export PS1="\[\e[33m\]\u@\h\[\e[0m\] \W \[\e[35m\]\`parse_git_branch\`\[\e[0m\]\n\$ "
export LSCOLORS=gxfxcxdxbxegedabagacad
15 changes: 2 additions & 13 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@ if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

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{green}%n@%m%f %. ${vcs_info_msg_0_}
%# '

export PATH="/usr/local/opt/curl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/curl/lib"
export CPPFLAGS="-I/usr/local/opt/curl/include"
export PATH="$HOME/.anyenv/bin:$PATH"

export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"
eval "$(starship init zsh)"

0 comments on commit 1182f83

Please sign in to comment.