と最近煽られたのでほげぇええええええええと言われないようにbashを少し改造しました。(最低限)
お前らのターミナルはダサい
設定移行で事故りたくないのでzsh移行は今度やる(しばらくやらない)
ディレクトリのフルパスとbranch名を表示
ディレクトリのフルパスとgithubのbranch名を表示するようにします。
.bashrc
に追記
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="\[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
lsに色をつける
.bash_profile
に追記
CLICOLOR=1
LSCOLORS=FxGxcxdxCxegedabagacad
CLICOLORはLSCOLORSを有効にする環境変数(man ls参考
)、1で有効
ls時の色を変更します。(ディレクトリとファイルを区別)
LSCOLORS Generatorsでプレビュー見ながら色を作れます。
bashコマンドの補完
brewでbash_completionをインストール
$ brew install bash_completion
.bash_source
に追記
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
途中までコマンドを入れた場合にタブで補完されるようになる
よく使うgitコマンド
git_completion入れるよりも
ぶっちゃけaliasで設定したほうが楽
.bashrc
に追記
# git
function gc() {
command git clone $1 --depth 1
}
alias gf='git fetch'
alias gch='git checkout'
alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -D'
alias gpl='git pull'
alias grh='git reset --hard'
alias gps='git push -u origin'
alias gpsf='git push -f origin'
alias gco='git commit -am'
alias gcoe='git commit --allow-empty -m'
alias gcl='git clean -dfx'
alias gl='git log'
alias gr='git rebase'
alias gri='git rebase -i'
alias grv='git revert'
alias gm='git merge'
alias gd='git diff'
alias ga='git add *'
alias gs='git stash'
alias gsp='git stash pop'
alias gcp='git cherry-pick'