mirror of
https://github.com/meineerde/dotfiles.git
synced 2025-12-19 16:51:12 +00:00
Cleanup
This commit is contained in:
parent
bf839a8208
commit
7ff42c2783
33
.bashrc
33
.bashrc
@ -59,12 +59,16 @@ if [[ $- =~ 'i' ]]; then
|
|||||||
|
|
||||||
# Setting up git.
|
# Setting up git.
|
||||||
if [[ -f ~/.gitconfig ]]; then
|
if [[ -f ~/.gitconfig ]]; then
|
||||||
if [ "$(git config --global user.name)" != "$USER_NAME" ]; then
|
user_name="$(git config --global user.name)"
|
||||||
echo "WARNING: git's user.name is $(git config --global user.name)"
|
user_email="$(git config --global user.email)"
|
||||||
|
|
||||||
|
if [ "$user_name" != "$USER_NAME" ]; then
|
||||||
|
echo "WARNING: git's user.name is $user_name"
|
||||||
fi
|
fi
|
||||||
if [ "$(git config --global user.email)" != "$USER_EMAIL" ]; then
|
if [ "$user_email" != "$USER_EMAIL" ]; then
|
||||||
echo "WARNING: git's user.email is $(git config --global user.email)"
|
echo "WARNING: git's user.email is $user_email"
|
||||||
fi
|
fi
|
||||||
|
unset user_name user_email
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -84,7 +88,7 @@ case `uname` in
|
|||||||
python="$(which python)"
|
python="$(which python)"
|
||||||
python_path=""
|
python_path=""
|
||||||
# Find correct python bin path with multiple Pythons installed by Homebrew
|
# Find correct python bin path with multiple Pythons installed by Homebrew
|
||||||
if [[ $(echo "$python" | grep '^/usr/local/bin') ]]; then
|
if [[ "$python" =~ ^/usr/local/bin ]]; then
|
||||||
# Python comes from Homebrew
|
# Python comes from Homebrew
|
||||||
target=$(readlink "$python")
|
target=$(readlink "$python")
|
||||||
if [[ $? ]]; then
|
if [[ $? ]]; then
|
||||||
@ -108,8 +112,8 @@ case `uname` in
|
|||||||
pdfman() { man -t $1 | open -a /Applications/Skim.app -f; }
|
pdfman() { man -t $1 | open -a /Applications/Skim.app -f; }
|
||||||
|
|
||||||
# Bash completion
|
# Bash completion
|
||||||
if [ -f `brew --prefix`/etc/bash_completion ]; then
|
if [[ -f "$(brew --prefix)/etc/bash_completion" ]]; then
|
||||||
. `brew --prefix`/etc/bash_completion
|
. "$(brew --prefix)/etc/bash_completion"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
@ -118,7 +122,7 @@ case `uname` in
|
|||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
# enable bash completion in interactive shells
|
# enable bash completion in interactive shells
|
||||||
if [ -f /etc/bash_completion ]; then
|
if [[ -f /etc/bash_completion |]; then
|
||||||
. /etc/bash_completion
|
. /etc/bash_completion
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -174,8 +178,8 @@ PS1="${debian_chroot:+($debian_chroot)}"
|
|||||||
|
|
||||||
# Short PWD, if it's to long.
|
# Short PWD, if it's to long.
|
||||||
short_pwd() {
|
short_pwd() {
|
||||||
FIXED_PWD=$(echo $PWD | sed "s:^$HOME:~:g")
|
FIXED_PWD="${PWD/#$HOME/~}"
|
||||||
if [ ${#FIXED_PWD} -gt $(($PWD_LENGTH)) ]; then
|
if [[ ${#FIXED_PWD} -gt $($PWD_LENGTH) ]]; then
|
||||||
echo "${FIXED_PWD:0:$((4))}...${FIXED_PWD:$((${#PWD}-$PWD_LENGTH+7)):$(($PWD_LENGTH-7))}"
|
echo "${FIXED_PWD:0:$((4))}...${FIXED_PWD:$((${#PWD}-$PWD_LENGTH+7)):$(($PWD_LENGTH-7))}"
|
||||||
else
|
else
|
||||||
echo "$FIXED_PWD"
|
echo "$FIXED_PWD"
|
||||||
@ -185,7 +189,7 @@ ps1_pwd='\[\e[1;30m\]$(short_pwd)\[\e[00m\]'
|
|||||||
#ps1_pwd='\[\e[1;30m\]\W\[\e[00m\]'
|
#ps1_pwd='\[\e[1;30m\]\W\[\e[00m\]'
|
||||||
|
|
||||||
# Building $PS1.
|
# Building $PS1.
|
||||||
if [[ -n "$ps1_user" ]] && [ -n "$ps1_host" ]; then ps1_user="$ps1_user@"; fi
|
if [[ -n "$ps1_user" ]] && [[ -n "$ps1_host" ]]; then ps1_user="$ps1_user@"; fi
|
||||||
PS1="$ps1_user$ps1_host"
|
PS1="$ps1_user$ps1_host"
|
||||||
if [[ "$PS1" != "" ]]; then PS1="$PS1\[\e[00m\]:"; fi
|
if [[ "$PS1" != "" ]]; then PS1="$PS1\[\e[00m\]:"; fi
|
||||||
export PS1="$PS1$ps1_pwd$ps1_vcs$ps1_ruby \$ "
|
export PS1="$PS1$ps1_pwd$ps1_vcs$ps1_ruby \$ "
|
||||||
@ -201,7 +205,7 @@ case "$TERM" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Enable color support. Don't add ls here, it behaves different on Darwin/BSD.
|
# Enable color support. Don't add ls here, it behaves different on Darwin/BSD.
|
||||||
if [[ -x /usr/bin/dircolors ]]; then eval "`dircolors -b`"; fi
|
if [[ -x /usr/bin/dircolors ]]; then eval "$(dircolors -b)"; fi
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
alias fgrep='fgrep --color=auto'
|
alias fgrep='fgrep --color=auto'
|
||||||
alias egrep='egrep --color=auto'
|
alias egrep='egrep --color=auto'
|
||||||
@ -229,6 +233,9 @@ alias goit='git'
|
|||||||
alias ss="script/server -b 127.0.0.1"
|
alias ss="script/server -b 127.0.0.1"
|
||||||
alias sc="script/console"
|
alias sc="script/console"
|
||||||
|
|
||||||
|
alias rs="rails server -b 127.0.0.1"
|
||||||
|
alias rc="rails console"
|
||||||
|
|
||||||
alias redcar="wrapped_redcar --fork"
|
alias redcar="wrapped_redcar --fork"
|
||||||
|
|
||||||
# if cat is called on a directory, call ls instead
|
# if cat is called on a directory, call ls instead
|
||||||
@ -236,7 +243,7 @@ cat() {
|
|||||||
if [[ $# = 1 ]] && [[ -d $1 ]]; then
|
if [[ $# = 1 ]] && [[ -d $1 ]]; then
|
||||||
ls $1
|
ls $1
|
||||||
else
|
else
|
||||||
`which cat` "$@"
|
/usr/bin/env cat "$@"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user