Skip to content

Instantly share code, notes, and snippets.

@xavierartot
Created April 18, 2014 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xavierartot/11061449 to your computer and use it in GitHub Desktop.
Save xavierartot/11061449 to your computer and use it in GitHub Desktop.
.zshrc
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Customize to your needs...
export PATH=$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/MAMP/Library/bin:/Users/xartot/snippets
#open a project
gotoweb(){
cd /Applications/MAMP/htdocs/$1
}
# autocompletion pour WP_CLI
#source //Users/xartot/scripts/wp-completion.bash
#
# WP-CLI Bash completions http://wp-cli.org/
#autoload bashcompinit
#bashcompinit
# initialize autocomplete here, otherwise functions won't be loaded
# also load compdef so git-completion doesn't complain about no compdef
#autoload -U compinit compdef
#compinit
#source $HOME/.wp-cli/vendor/wp-cli/wp-cli/utils/wp-completion.bash
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
#ZSH_THEME="pygmalion"
alias h="history"
# Set to this to use case-sensitive completion
CASE_SENSITIVE="true"
# Comment this out to disable bi-weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment to change how often before auto-updates occur? (in days)
# export UPDATE_ZSH_DAYS=13
# Uncomment following line if you want to disable autosetting terminal title.
DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want red dots to be displayed while waiting for completion
COMPLETION_WAITING_DOTS="true"
# Uncomment 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)
plugins=(git)
source $ZSH/oh-my-zsh.sh
#PATH=$PATH:/Applications/MAMP/Library/bin
setopt correctall
# autocompletion git
# source ~/.git-completion.bash
# This alias recursively destroys all .DS_Store files in the folder I am currently in
alias killDS='find . -name .DS_Store -type f -delete'
alias dir='ls -alv'
# cdd let you do a cd AND a ls in the same command
function cdd()
{
if [ "$*" = "" ]
then
cd
else
cd "$*";
fi
dir;
}
# This alias reloads this file
alias reload_zsh='. ~/.zshrc'
# Clear the terminal of it's output
alias c='clear'
#alias le='ls --sort=extension'
#alias lle='ll --sort=extension'
#alias lt='ls --sort=time'
#alias llt='ll --sort=time'
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# Show which commands you use the most
alias freq='cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30'
alias ....='cd ../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../../'
alias .6='cd ../../../../../../'
alias .7='cd ../../../../../../../'
alias .8='cd ../../../../../../../../'
#Find text in any file
ft() {
find . -name "$2" -exec grep -il "$1" {} \;
}
# Add and commit changes with Git
alias m="git add -A;git commit -m"
#copy
alias pc="pbcopy"
#cppwd
alias pcpwd="pwd | tr -d '\n' | pbcopy"
#paste
alias pp="pbpaste"
source ~/wp-completion.bash
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
fg
zle redisplay
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment