Move .bash_profile to .zshrc.
This commit is contained in:
-163
@@ -1,163 +0,0 @@
|
||||
#
|
||||
# .bash_profile
|
||||
#
|
||||
# @author Jeff Geerling
|
||||
# @see .inputrc
|
||||
#
|
||||
|
||||
# Nicer prompt.
|
||||
export PS1="\[\e[0;32m\] \[\e[1;32m\]\t \[\e[0;2m\]\w \[\e[0m\]\$ "
|
||||
|
||||
# Use colors.
|
||||
export CLICOLOR=1
|
||||
export LSCOLORS=ExFxCxDxBxegedabagacad
|
||||
|
||||
# Custom $PATH with extra locations.
|
||||
export PATH=/usr/local/bin:/usr/local/sbin:$HOME/bin:/usr/local/git/bin:$HOME/.composer/vendor/bin:$PATH
|
||||
|
||||
# Include alias file (if present) containing aliases for ssh, etc.
|
||||
if [ -f ~/.bash_aliases ]
|
||||
then
|
||||
source ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# Include bashrc file (if present).
|
||||
if [ -f ~/.bashrc ]
|
||||
then
|
||||
source ~/.bashrc
|
||||
fi
|
||||
|
||||
# Syntax-highlight code for copying and pasting.
|
||||
# Requires highlight (`brew install highlight`).
|
||||
function pretty() {
|
||||
pbpaste | highlight --syntax=$1 -O rtf | pbcopy
|
||||
}
|
||||
|
||||
# Git aliases.
|
||||
alias gs='git status'
|
||||
alias gc='git commit'
|
||||
alias gp='git pull --rebase'
|
||||
alias gcam='git commit -am'
|
||||
alias gl='git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
|
||||
|
||||
# Git upstream branch syncer.
|
||||
# Usage: gsync master (checks out master, pull upstream, push origin).
|
||||
function gsync() {
|
||||
if [[ ! "$1" ]] ; then
|
||||
echo "You must supply a branch."
|
||||
return 0
|
||||
fi
|
||||
|
||||
BRANCHES=$(git branch --list $1)
|
||||
if [ ! "$BRANCHES" ] ; then
|
||||
echo "Branch $1 does not exist."
|
||||
return 0
|
||||
fi
|
||||
|
||||
git checkout "$1" && \
|
||||
git pull upstream "$1" && \
|
||||
git push origin "$1"
|
||||
}
|
||||
|
||||
# Tell homebrew to not autoupdate every single time I run it (just once a week).
|
||||
export HOMEBREW_AUTO_UPDATE_SECS=604800
|
||||
|
||||
# Turn on Git autocomplete.
|
||||
# brew_prefix=`brew --prefix`
|
||||
brew_prefix='/usr/local'
|
||||
if [ -f $brew_prefix/etc/bash_completion ]; then
|
||||
. $brew_prefix/etc/bash_completion
|
||||
fi
|
||||
|
||||
# Turn on kubectl autocomplete.
|
||||
if [ -x "$(command -v kubectl)" ]; then
|
||||
source <(kubectl completion bash)
|
||||
fi
|
||||
|
||||
# Use brew-installed PHP binaries.
|
||||
export PATH="/usr/local/opt/php@7.2/bin:$PATH"
|
||||
export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
|
||||
|
||||
# Use nvm.
|
||||
# export NVM_DIR="$HOME/.nvm"
|
||||
# . "$brew_prefix/opt/nvm/nvm.sh"
|
||||
|
||||
# Use rbenv.
|
||||
# if [ -f /usr/local/bin/rbenv ]; then
|
||||
# eval "$(rbenv init -)"
|
||||
# fi
|
||||
|
||||
# Python settings.
|
||||
export PYTHONPATH="/usr/local/lib/python2.7/site-packages"
|
||||
|
||||
# Super useful Docker container oneshots.
|
||||
# Usage: dockrun, or dockrun [centos7|fedora27|debian9|debian8|ubuntu1404|etc.]
|
||||
dockrun() {
|
||||
docker run -it geerlingguy/docker-"${1:-ubuntu1604}"-ansible /bin/bash
|
||||
}
|
||||
|
||||
# Enter a running Docker container.
|
||||
function denter() {
|
||||
if [[ ! "$1" ]] ; then
|
||||
echo "You must supply a container ID or name."
|
||||
return 0
|
||||
fi
|
||||
|
||||
docker exec -it $1 bash
|
||||
return 0
|
||||
}
|
||||
|
||||
# Docker image visualization (usage: `dockviz images -t`).
|
||||
alias dockviz="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz"
|
||||
|
||||
# Delete a given line number in the known_hosts file.
|
||||
knownrm() {
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $1 =~ $re ]] ; then
|
||||
echo "error: line number missing" >&2;
|
||||
else
|
||||
sed -i '' "$1d" ~/.ssh/known_hosts
|
||||
fi
|
||||
}
|
||||
|
||||
# Ask for confirmation when 'prod' is in a command string.
|
||||
prod_command_trap () {
|
||||
if [[ $BASH_COMMAND == *prod* ]]
|
||||
then
|
||||
read -p "Are you sure you want to run this command on prod [Y/n]? " -n 1 -r
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
echo -e "\nRunning command \"$BASH_COMMAND\" \n"
|
||||
else
|
||||
echo -e "\nCommand was not run.\n"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
shopt -s extdebug
|
||||
trap prod_command_trap DEBUG
|
||||
|
||||
function blt() {
|
||||
if [[ ! -z ${AH_SITE_ENVIRONMENT} ]]; then
|
||||
PROJECT_ROOT="/var/www/html/${AH_SITE_GROUP}.${AH_SITE_ENVIRONMENT}"
|
||||
elif [ "`git rev-parse --show-cdup 2> /dev/null`" != "" ]; then
|
||||
PROJECT_ROOT=$(git rev-parse --show-cdup)
|
||||
else
|
||||
PROJECT_ROOT="."
|
||||
fi
|
||||
|
||||
if [ -f "$PROJECT_ROOT/vendor/bin/blt" ]; then
|
||||
$PROJECT_ROOT/vendor/bin/blt "$@"
|
||||
|
||||
# Check for local BLT.
|
||||
elif [ -f "./vendor/bin/blt" ]; then
|
||||
./vendor/bin/blt "$@"
|
||||
|
||||
else
|
||||
echo "You must run this command from within a BLT-generated project."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
||||
@@ -0,0 +1,120 @@
|
||||
#
|
||||
# .bash_profile
|
||||
#
|
||||
# @author Jeff Geerling
|
||||
# @see .inputrc
|
||||
#
|
||||
|
||||
# Colors.
|
||||
unset LSCOLORS
|
||||
export CLICOLOR=1
|
||||
export CLICOLOR_FORCE=1
|
||||
|
||||
# Nicer prompt.
|
||||
PS1="%F{green} %*%F %3~ %F{white}$ "
|
||||
|
||||
# Custom $PATH with extra locations.
|
||||
#export PATH=/usr/local/bin:/usr/local/sbin:$HOME/bin:/usr/local/git/bin:$HOME/.composer/vendor/bin:$PATH
|
||||
|
||||
# Include alias file (if present) containing aliases for ssh, etc.
|
||||
if [ -f ~/.bash_aliases ]
|
||||
then
|
||||
source ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# Git aliases.
|
||||
alias gs='git status'
|
||||
alias gc='git commit'
|
||||
alias gp='git pull --rebase'
|
||||
alias gcam='git commit -am'
|
||||
alias gl='git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
|
||||
|
||||
# Completions.
|
||||
autoload -Uz compinit && compinit
|
||||
# Case insensitive.
|
||||
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*'
|
||||
|
||||
# Git upstream branch syncer.
|
||||
# Usage: gsync master (checks out master, pull upstream, push origin).
|
||||
#function gsync() {
|
||||
# if [[ ! "$1" ]] ; then
|
||||
# echo "You must supply a branch."
|
||||
# return 0
|
||||
# fi
|
||||
#
|
||||
# BRANCHES=$(git branch --list $1)
|
||||
# if [ ! "$BRANCHES" ] ; then
|
||||
# echo "Branch $1 does not exist."
|
||||
# return 0
|
||||
# fi
|
||||
#
|
||||
# git checkout "$1" && \
|
||||
# git pull upstream "$1" && \
|
||||
# git push origin "$1"
|
||||
#}
|
||||
|
||||
# Tell homebrew to not autoupdate every single time I run it (just once a week).
|
||||
#export HOMEBREW_AUTO_UPDATE_SECS=604800
|
||||
|
||||
# Turn on Git autocomplete.
|
||||
# brew_prefix=`brew --prefix`
|
||||
#brew_prefix='/usr/local'
|
||||
#if type brew &>/dev/null; then
|
||||
# FPATH=$brew_prefix/share/zsh/site-functions:$FPATH
|
||||
#fi
|
||||
|
||||
# Turn on kubectl autocomplete.
|
||||
#if [ -x "$(command -v kubectl)" ]; then
|
||||
# source <(kubectl completion bash)
|
||||
#fi
|
||||
|
||||
# Use brew-installed PHP binaries.
|
||||
#export PATH="/usr/local/opt/php@7.2/bin:$PATH"
|
||||
#export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
|
||||
|
||||
# Python settings.
|
||||
#export PYTHONPATH="/usr/local/lib/python2.7/site-packages"
|
||||
|
||||
# Super useful Docker container oneshots.
|
||||
# Usage: dockrun, or dockrun [centos7|fedora27|debian9|debian8|ubuntu1404|etc.]
|
||||
#dockrun() {
|
||||
# docker run -it geerlingguy/docker-"${1:-ubuntu1604}"-ansible /bin/bash
|
||||
#}
|
||||
|
||||
# Enter a running Docker container.
|
||||
#function denter() {
|
||||
# if [[ ! "$1" ]] ; then
|
||||
# echo "You must supply a container ID or name."
|
||||
# return 0
|
||||
# fi
|
||||
#
|
||||
# docker exec -it $1 bash
|
||||
# return 0
|
||||
#}
|
||||
|
||||
# Delete a given line number in the known_hosts file.
|
||||
#knownrm() {
|
||||
# re='^[0-9]+$'
|
||||
# if ! [[ $1 =~ $re ]] ; then
|
||||
# echo "error: line number missing" >&2;
|
||||
# else
|
||||
# sed -i '' "$1d" ~/.ssh/known_hosts
|
||||
# fi
|
||||
#}
|
||||
|
||||
# Ask for confirmation when 'prod' is in a command string.
|
||||
#prod_command_trap () {
|
||||
# if [[ $BASH_COMMAND == *prod* ]]
|
||||
# then
|
||||
# read -p "Are you sure you want to run this command on prod [Y/n]? " -n 1 -r
|
||||
# if [[ $REPLY =~ ^[Yy]$ ]]
|
||||
# then
|
||||
# echo -e "\nRunning command \"$BASH_COMMAND\" \n"
|
||||
# else
|
||||
# echo -e "\nCommand was not run.\n"
|
||||
# return 1
|
||||
# fi
|
||||
# fi
|
||||
#}
|
||||
#shopt -s extdebug
|
||||
#trap prod_command_trap DEBUG
|
||||
Reference in New Issue
Block a user