Last active
December 30, 2016 01:24
-
-
Save piyo-ko/030dc71622222e9016ffae8a1861968e to your computer and use it in GitHub Desktop.
settings in .bash_profile for macOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lsの表示を好みに合わせる。 | |
alias ls='ls -Fav' | |
export CLICOLOR=1 | |
export LSCOLORS=dxgxbxexcxBxFxCxExDxBx | |
#grepの表示も好みに合わせる。 | |
alias grep='grep --color=auto' | |
#export GREP_COLOR='01;33' #太字で黄色 | |
export GREP_COLOR='38;5;203' #太字なし。256色のうちから色を指定。 | |
#063=ラベンダー、083=萌黄、035=翡翠、203=珊瑚、130=オレンジ | |
#うっかり上書きしないように-i。属性を保つように-a。 | |
alias cp='cp -ai' | |
#うっかり消さないように-i | |
alias rm='rm -i' | |
#テキストエディタはmi.appが好きなので、任意の拡張子の開きたいファイルをパッとmiで開けるようにしておく | |
alias opmi='open -a mi.app' | |
#Chrome内ではChromeを常にシークレットモードに設定できないみたいなので、コマンドラインからシークレットモード指定で簡単に開けるようにしておく。 | |
alias chrome='open -a /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args -incognito' | |
#emojifyがインストールされていて、かつ、gitのコミットメッセージに絵文字を使う習慣がある、という前提で、git logの好みの表示をaliasにしておく。 | |
#その1 (ブランチの分岐が表示される。git logの省略でgiloという名にした) | |
alias gilo="git log --all --graph --pretty=format:'%C(blue)%h %C(cyan)[%cd] %C(magenta)%d%Creset %s' --date=iso --date-order| perl -pe 's/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \+0900/\1/g;' | emojify" | |
#その2 (その1に似ているが、最近10回のコミットのみ表示。giloの後ろに10と付けた) | |
alias gilo10="git log --all --graph --pretty=format:'%C(blue)%h %C(cyan)[%cd] %C(magenta)%d%Creset %s' --date=iso --date-order --max-count=10 | perl -pe 's/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) \+0900/\1/g;' | emojify" | |
#その3 (その2に似ているが、時刻は省略し、長いメッセージはちょん切る。git log simpleのつもりでgilsという名にしてみた) | |
alias gils="git log --all --graph --pretty=format:'%C(blue)%h %C(cyan)[%cd] %C(magenta)%d%Creset %s' --date=short --date-order --max-count=10 | emojify | cut -n -b 1-140" | |
# 環境変数 | |
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Applications/Xcode.app/Contents/Developer/Tools | |
export MANPATH=/usr/local/share/man:/usr/share/man | |
#gnuplot用の設定 | |
export GNUTERM=aqua | |
# bcコマンドのscale (小数点以下の桁数) がデフォルトで0なので、~/.bc で好みの設定をしておく。 | |
export BC_ENV_ARGS="${HOME}/.bc" | |
#プロンプト文字列 | |
export PS1="\u@\W\[\033[34m\]{\$(date '+%Y-%m-%d %H:%M:%S')}\[\033[1;36m\]\$\[\033[0m\] " | |
#今、時間に余裕があれば、brew updateとbrew upgradeとbrew cleanupを行う。 | |
#(SSL handshakeで失敗ばっかりしてなかなか成功しない時期があったので、ifでなくwhileにしてある。) | |
while : | |
do | |
echo "今は `date '+%Y-%m-%d %H:%M:%S'` ですよ。" | |
echo 'brew updateとbrew upgradeを行う? [y/n]' | |
read answer | |
if [ $answer = 'y' ] | |
then | |
echo 'さてさてbrew updateしますよ〜' | |
brew update | |
echo 'brew upgradeもしますよ〜' | |
brew upgrade | |
echo '最後にbrew cleanupでお掃除で〜す' | |
brew cleanup | |
else | |
break | |
fi | |
done | |
#今、時間に余裕があれば、TeXLiveを更新する。 | |
echo "今は `date '+%Y-%m-%d %H:%M:%S'` ですよ。" | |
echo 'TexLiveを更新する? [y/n]' | |
read answer | |
if [ $answer = 'y' ] | |
then | |
sudo tlmgr update --self --all | |
fi | |
#最後に御挨拶 | |
echo 'こんにちは!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment