Last active
August 29, 2015 14:06
-
-
Save makenowjust/651ba87ec056aec2ed26 to your computer and use it in GitHub Desktop.
情報の授業で使っているbashrcです
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 --color' | |
| alias lsa='ls -a' | |
| # mkdir + cd = take | |
| take() { | |
| mkdir $1 && cd $1 | |
| } | |
| # cdコマンドのオーバーライド | |
| my_cd() { | |
| pushd "${1:-$HOME}" >/dev/null && ls | |
| } | |
| my_..() { | |
| popd "$@" >/dev/null && ls | |
| } | |
| alias cd='my_cd' | |
| alias ..='my_..' | |
| # 移動するディレクトリをいい感じに訂正してくれる | |
| shopt -s cdspell | |
| # どこからでもcdできるディレクトリ | |
| CDPATH="$HOME:$HOME/src" | |
| # 色関係の関数 | |
| rgb() { | |
| local red=$(( $1 * 6 / 256 )) | |
| local green=$(( $2 * 6 / 256 )) | |
| local blue=$(( $3 * 6 / 256 )) | |
| echo $(( red * 36 + green * 6 + blue + 16 )) | |
| } | |
| color() { | |
| echo "\["$'\e'"[38;5;${1}m\]" | |
| } | |
| background() { | |
| echo "\["$'\e'"[48;5;${1}m\]" | |
| } | |
| default_color="\["$'\e'"[0m\]" | |
| # プロンプトの設定 | |
| PS1=$'\n' | |
| PS1="$PS1\[\e[48;5;\$((\$? == 0 ? 26 : 161))m\]$(color 15) \u@\h $(background 238) \w $(background 240) \$(date +\"%Y/%m/%d %H:%M:%S\") ${default_color}" | |
| PS1="$PS1\n$(color 15)$(background 236) % ${default_color} " | |
| PS2="$(color 15)$(background 236) > ${default_color} " | |
| #プロクシの設定 | |
| source "$HOME/.bashrc_proxy" | |
| # nodebrewの設定 | |
| export PATH=$HOME/.nodebrew/current/bin:$PATH | |
| # ホームディレクトリをパスに | |
| export PATH="$HOME/bin:$PATH" | |
| export CPATH="$HOME/include:$CPATH" | |
| export LIBRARY_PATH="$HOME/lib:$LIBRARY_PATH" | |
| export PKG_CONFIG_PATH="$HOME/lib/pkgconfig:$PKG_CONFIG_PATH" | |
| # 拡張グロブを有効にする | |
| shopt -s extglob |
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
| # Up and Down | |
| "\e[A": history-search-backward | |
| "\e[B": history-search-forward | |
| # Ctrl-Up and Ctrl-Down | |
| "\e[1;5A": reverse-search-history | |
| "\e[B;5B": forward-search-history | |
| # Ctrl-Left and Ctrl-Right | |
| "\e[1;5D": backward-word | |
| "\e[1;5C": forward-word |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment