Created
January 18, 2018 19:06
-
-
Save Ionaru/4e0f43d9ba30f6ffff431233dde9d8b7 to your computer and use it in GitHub Desktop.
This file contains 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
# Exported environment variables | |
export PATH=/usr/local/bin:$HOME/bin:/usr/bin:/bin:/usr/games:$HOME/Software | |
export ZSH=/home/<SNIP>/.oh-my-zsh | |
export PYTHONPATH=. | |
export SSH_KEY_PATH="~/.ssh/rsa_id" | |
export SUDO_EDITOR=kate | |
# Virtualenv environment variables & import | |
VIRTUAL_ENV_DISABLE_PROMPT=1 | |
AUTOSWITCH_SILENT=1 | |
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh | |
# Reset virtualenv | |
if ! [ -z "$VIRTUAL_ENV" ]; then | |
deactivate | |
fi | |
# ZSH environment variables & import | |
ZSH_THEME="agnoster-custom" | |
DEFAULT_USER="jeroen.akkerman" | |
source $ZSH/oh-my-zsh.sh | |
# zplug | |
source ~/.zplug/init.zsh | |
zplug "plugins/git", from:oh-my-zsh | |
zplug "plugins/command-not-found", from:oh-my-zsh | |
zplug "plugins/emoji", from:oh-my-zsh | |
zplug "plugins/git-flow", from:oh-my-zsh | |
zplug "plugins/gulp", from:oh-my-zsh | |
zplug "plugins/ng", from:oh-my-zsh | |
zplug "plugins/npm", from:oh-my-zsh | |
zplug "plugins/perms", from:oh-my-zsh | |
zplug "plugins/pip", from:oh-my-zsh | |
zplug "plugins/pylint", from:oh-my-zsh | |
zplug "plugins/python", from:oh-my-zsh | |
zplug "plugins/web-search", from:oh-my-zsh | |
zplug "plugins/yarn", from:oh-my-zsh | |
zplug "MichaelAquilina/zsh-autoswitch-virtualenv" | |
zplug load | |
# Colours | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Colour | |
# Alias functions | |
function up { | |
if [[ "$#" < 1 ]] ; then | |
cd .. | |
else | |
CDSTR="" | |
for i in {1..$1} ; do | |
CDSTR="../$CDSTR" | |
done | |
cd $CDSTR | |
fi | |
} | |
function yarn { | |
/usr/bin/yarn ${@:1} --emoji | |
} | |
function detach { | |
nohup ${@:1} &! | |
} | |
function workoff { | |
if ! [ -z "$VIRTUAL_ENV" ]; then | |
deactivate | |
fi | |
} | |
# Run a command multiple times | |
function run() { | |
number=$1 | |
shift | |
for i in `seq $number`; do | |
$@ | |
done | |
} | |
# Docker list containers and images | |
docker() { | |
if [[ $@ == "containers" ]]; then | |
command docker ps | |
elif [[ $@ == "ls" ]]; then | |
echo "${GREEN}Images:${NC}" | |
command docker images | |
echo | |
echo "${GREEN}Containers:${NC}" | |
command docker ps -a | |
else | |
command docker $@ | |
fi | |
} | |
# Print aliased command | |
function _-accept-line () { | |
emulate -L zsh | |
local -a WORDS | |
WORDS=( ${(z)BUFFER} ) | |
local -r FIRSTWORD=${WORDS[1]} | |
local -r GREEN=$'\e[32m' RESET_COLORS=$'\e[0m' | |
[[ "$(whence -w $FIRSTWORD 2>/dev/null)" == "${FIRSTWORD}: alias" ]] && | |
echo -nE $'\n'"Alias -> ${GREEN}$(whence $FIRSTWORD)${RESET_COLORS}"$'\n' | |
zle .accept-line | |
} | |
zle -N accept-line _-accept-line | |
# Aliases | |
alias sudo="sudo" | |
alias zshconfig="detach code --unity-launch ~/.zshrc >/dev/null 2>&1" | |
alias ohmyzsh="detach dolphin ~/.oh-my-zsh" | |
alias r="source ~/.zshrc" | |
alias c='clear && echo -en "\e[3J"' | |
alias rc='c && r' | |
alias web="python -m SimpleHTTPServer" | |
alias x="workoff && xephyr_wrapper" | |
alias copy="cp" | |
alias move="mv" | |
alias go="cd" | |
alias ls="ls -lahF --color=auto" | |
alias dir="ls" | |
alias npm="npm --verbose" | |
alias npmi="npm install --verbose" | |
alias npmig="sudo npm install --global --verbose" | |
alias npmr="npm remove --verbose" | |
alias npmrg="sudo npm remove --global --verbose" | |
alias npml="npm list --depth=0 --verbose" | |
alias npmlg="sudo npm list --global --depth=0 --verbose" | |
alias install="sudo apt-get install" | |
alias remove="sudo apt-get remove" | |
alias purge="sudo apt-get purge" | |
alias cleanup="sudo apt autoremove" | |
alias update="echo \"${GREEN}Update started${NC}\" && sudo apt-get update && sudo apt-get upgrade && echo \"${GREEN}Update complete!${NC}\"" | |
alias planning="cd ~/Projects/easyplanning" | |
alias get="curl --compressed" | |
alias gitreset="git reset HEAD --hard" | |
alias syslog="tail /var/log/syslog" | |
cd ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment