You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

109 lines
2.9 KiB

#!/bin/bash
set -o vi
bind -m vi-insert "\C-l":clear-screen
shopt -s extglob
HISTSIZE=
HISTFILESIZE=
export EDITOR='nvim'
export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers"
export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz"
export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers"
export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz"
export LESS='-R'
export LESSOPEN='|~/.lessfilter %s'
alias ls="ls --color=auto" \
vb='nvim ~/.bashrc && source ~/.bashrc' \
va='nvim ~/.config/aliasrc && source ~/.bashrc'
if [[ $(uname) != "Linux" ]]; then
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true
export HOMEBREW_NO_INSTALL_CLEANUP=1
export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com"
export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com"
alias ls="ls -G" \
vb='nvim ~/.bash_profile && source ~/.bash_profile' \
va='nvim ~/.config/aliasrc && source ~/.bash_profile'
mount-hdd() {
if [ -z $1 ]; then
sudo umount /dev/disk2s1 && sudo /usr/local/bin/ntfs-3g /dev/disk2s1 /Volumes/NTFS -olocal -oallow_other
else
sudo umount /dev/$1 && sudo /usr/local/bin/ntfs-3g /dev/$1 /Volumes/NTFS -olocal -oallow_other
fi
}
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')"
fi
source ~/.config/aliasrc
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1=" \[\033[0;36m\]\t \[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] "
mkcd() {
if [ ! -d "$1" ]; then
mkdir -p "$1" && cd "$1"
elif [ -d "$1" ]; then
cd "$1"
else
echo "Error"
fi
}
# Go up directory structures
up() {
cd $(printf "%0.0s../" $(seq 1 $1));
}
git() {
if [[ $@ == "mergetool" ]]; then
command git mergetool --no-gui
else
command git $@
fi
}
# git branch -vv | grep 'gone\]' | awk ' { print $1 }' | xargs -p git branch -d
git-prune() {
if [[ $@ == "--apply" ]]; then
command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d
else
echo "Run \"git prune --apply\" to delete the following branches:"
command git branch --merged develop | grep -vEw "develop$|master$"
fi
}
color-diff() {
if [ -z ${1+x} ] || [ -z ${2+x} ]; then
echo "Usage: color-diff dir1/ dir2/"
return
fi
diff -bur $1 $2 | colordiff | less
}
export NVM_DIR="$HOME/.nvm"
[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm
[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"