More .zshrc modifications to match old .bash_profile.

This commit is contained in:
Jeff Geerling
2019-11-03 23:01:56 -06:00
parent 6d7d64277b
commit 43186ce5cb
+45 -58
View File
@@ -11,15 +11,18 @@ export CLICOLOR=1
export CLICOLOR_FORCE=1
# Nicer prompt.
PS1="%F{green} %*%F %3~ %F{white}$ "
export PS1="%F{green} %*%F %3~ %F{white}$ "
# Enable plugins.
plugins=(git brew history kubectl)
# Custom $PATH with extra locations.
#export PATH=/usr/local/bin:/usr/local/sbin:$HOME/bin:/usr/local/git/bin:$HOME/.composer/vendor/bin:$PATH
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 ]
if [ -f ~/.aliases ]
then
source ~/.bash_aliases
source ~/.aliases
fi
# Git aliases.
@@ -36,71 +39,55 @@ zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}
# 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"
#}
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"
export HOMEBREW_AUTO_UPDATE_SECS=604800
# Python settings.
#export PYTHONPATH="/usr/local/lib/python2.7/site-packages"
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
#}
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
#}
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
#}
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 () {