Skip to content

Instantly share code, notes, and snippets.

@eliasmalik
Created March 26, 2017 16:39
Show Gist options
  • Save eliasmalik/1e0e12403dd138776c419386e8a2d564 to your computer and use it in GitHub Desktop.
Save eliasmalik/1e0e12403dd138776c419386e8a2d564 to your computer and use it in GitHub Desktop.
Zsh config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
####
#### oh-my-zsh setup
####
# Path to your oh-my-zsh installation.
export ZSH=/Users/elias/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="geometry/geometry"
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git gitfast git-extras autojump brew npm osx sudo)
source $ZSH/oh-my-zsh.sh
####
#### Custom Config
####
# Theme customisation
PROMPT_GEOMETRY_EXEC_TIME=true
PROMPT_GEOMETRY_COLORIZE_ROOT=true
GEOMETRY_PROMPT_SUFFIX="> "
###
# System
###
alias sz='source ~/.zshrc'
alias g8='nocorrect g8'
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
path() {
echo $PATH | tr ":" "\n" | \
awk "{ sub(\"/usr\", \"$fg_no_bold[green]/usr$reset_color\"); \
sub(\"/bin\", \"$fg_no_bold[blue]/bin$reset_color\"); \
sub(\"/opt\", \"$fg_no_bold[cyan]/opt$reset_color\"); \
sub(\"/sbin\", \"$fg_no_bold[magenta]/sbin$reset_color\"); \
sub(\"/local\", \"$fg_no_bold[yellow]/local$reset_color\"); \
print }"
}
###
# Web
###
alias myip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2'
alias fdns='dscacheutil -flushcache'
alias lstn='lsof -i | grep LISTEN'
alias hosts='nano /etc/hosts'
###
# Apache
###
alias apache.host='nano /etc/apache2/httpd.conf'
alias apache.vhost='nano /etc/apache2/extra/httpd-vhost.conf'
alias apache.restart='sudo apachectl graceful'
###
# Node.js
###
alias ni='node-inspector --no-preload'
alias nr='npm run'
alias nb='node --inspect=9292 --debug-brk'
###
# PostgreSQL
###
export PGDATA="/usr/local/var/postgres/"
alias psql.start="pg_ctl -l /dev/null start"
alias psql.stop="pg_ctl stop"
alias psql.restart="pg_ctl -l /dev/null restart"
###
# MySQL
###
export PATH="/usr/local/mysql/bin:${PATH}"
alias mysql.server="/usr/local/mysql/support-files/mysql.server"
alias mysql.start="sudo mysql.server start"
alias mysql.stop="sudo mysql.server stop"
alias mysql.restart="sudo mysql.server restart"
###
# ZSH Options
###
setopt auto_cd
setopt append_history
setopt inc_append_history
setopt hist_ignore_dups
setopt hist_find_no_dups
setopt hist_reduce_blanks
setopt complete_in_word
setopt always_to_end
###
# ZSH Bindkeys
###
bindkey "^K" kill-whole-line
bindkey "^]" end-of-line
bindkey "^[" beginning-of-line
###
# Github
###
function ggi {
domain="https://raw.githubusercontent.com"
path="/github/gitignore/master/${1^}.gitignore"
file=$(curl ${domain}${path})
target=$(pwd)/.gitignore
touch ${target}
echo "$file" > ${target}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment