諸行無常

IT色々お勉強中のブログ

20190421ワイの .bashrc

HISTSIZE=50000

alias ll='ls -la'
alias vi='vim'
alias dock='docker-compose'
alias ctags="`brew --prefix`/bin/ctags"

alias xl='cd ~/Xleap'
source /usr/local/etc/bash_completion.d/git-prompt.sh
source /usr/local/etc/bash_completion.d/git-completion.bash
java -jar $HOME/lib/java/plantuml.jar -tpng $@

GIT_PS1_SHOWDIRTYSTATE=true
export PS1='\h\[\033[00m\]:\W\[\033[31m\]$(__git_ps1 [%s])\[\033[00m\]\$ '

if [ -f ~/.nodebrew/completions/bash/nodebrew-completion ]; then
    . ~/.nodebrew/completions/bash/nodebrew-completion
fi

export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
shopt -u histappend

[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# fbr - checkout git branch
fbr() {
  local branches branch
  branches=$(git branch -vv) &&
  branch=$(echo "$branches" | fzf +m) &&
  git checkout $(echo "$branch" | awk '{print $1}' | sed "s/.* //")
}
# fbrm - checkout git branch (including remote branches)
fbrm() {
  local branches branch
  branches=$(git branch --all | grep -v HEAD) &&
  branch=$(echo "$branches" |
           fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) &&
  git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
fvimg() {
  vim $(git ls-files | xargs grep "" | fzf -m | sed -e 's/:/ /' | awk '{print $1}')
}