Last active
November 27, 2018 18:10
-
-
Save sheatsb/e4570417b8fab0678bbdea0539629c57 to your computer and use it in GitHub Desktop.
latest zshrc
This file contains hidden or 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
| # | |
| # Executes commands at the start of an interactive session. | |
| # | |
| # Authors: | |
| # Sorin Ionescu <[email protected]> | |
| # | |
| # Source Prezto. | |
| if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then | |
| source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" | |
| fi | |
| # Editors | |
| # Tells your shell that when a program requires various editors, use sublime. | |
| # The -w flag tells your shell to wait until sublime exits | |
| export VISUAL="subl -w" | |
| export SVN_EDITOR="subl -w" | |
| export GIT_EDITOR="subl -w" | |
| export EDITOR="subl -w" | |
| # Helpful Functions | |
| # ===================== | |
| # A function to CD into the desktop from anywhere | |
| # so you just type desktop. | |
| # HINT: It uses the built in USER variable to know your OS X username | |
| # USE: desktop | |
| # desktop subfolder | |
| function desk { | |
| cd /Users/$USER/Desktop/$@ | |
| } | |
| # A function to easily grep for a matching process | |
| # USE: psg postgres | |
| function psg { | |
| FIRST=`echo $1 | sed -e 's/^\(.\).*/\1/'` | |
| REST=`echo $1 | sed -e 's/^.\(.*\)/\1/'` | |
| ps aux | grep "[$FIRST]$REST" | |
| } | |
| # A function to extract correctly any archive based on extension | |
| # USE: extract imazip.zip | |
| # extract imatar.tar | |
| function extract () { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xjf $1 ;; | |
| *.tar.gz) tar xzf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) rar x $1 ;; | |
| *.gz) gunzip $1 ;; | |
| *.tar) tar xf $1 ;; | |
| *.tbz2) tar xjf $1 ;; | |
| *.tgz) tar xzf $1 ;; | |
| *.zip) unzip $1 ;; | |
| *.Z) uncompress $1 ;; | |
| *) echo "'$1' cannot be extracted via extract()" ;; | |
| esac | |
| else | |
| echo "'$1' is not a valid file" | |
| fi | |
| } | |
| # A function to make and cd into directories as needed | |
| # (A good way to cut down on keystrokes) | |
| mcd () { | |
| case "$1" in | |
| */..|*/../) cd -- "$1";; # that doesn't make any sense unless the directory already exists | |
| /*/../*) (cd "${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd -- "$1";; | |
| /*) mkdir -p "$1" && cd "$1";; | |
| */../*) (cd "./${1%/../*}/.." && mkdir -p "./${1##*/../}") && cd "./$1";; | |
| ../*) (cd .. && mkdir -p "${1#.}") && cd "$1";; | |
| *) mkdir -p "./$1" && cd "./$1";; | |
| esac | |
| } | |
| # Aliases | |
| # ===================== | |
| # Exit Terminal | |
| alias byebye="killall Terminal" | |
| # LS | |
| alias lsa='ls -lah' | |
| # Git | |
| alias gcl="git clone" | |
| alias gst="git status" | |
| alias gl="git pull" | |
| alias gp="git push" | |
| alias gd="git diff | mate" | |
| alias gc="git commit -v" | |
| alias gca="git commit -v -a" | |
| alias gb="git branch" | |
| alias gba="git branch -a" | |
| alias gcam="git commit -am" | |
| alias gbb="git branch -b" | |
| # Use shortcut for editing this file | |
| alias zconf="vscode ~/.zshrc" | |
| alias sourceup="source ~/.zshrc" | |
| # Create alias for code command | |
| alias edit="vscode" | |
| # Simple HTTP server | |
| alias simpleserver="python -m http.server 8000" | |
| alias phpserver="php -S 127.0.0.1:8000" | |
| # Update package managers easily | |
| alias upwards="brew update && brew upgrade && brew cleanup && npm -g up && gem update && gem update --system && gem cleanup" | |
| # Flush DNS | |
| alias flushdns="sudo killall -HUP mDNSResponder; sleep 2; echo macOS DNS Cache Reset" | |
| # Youtube DL | |
| alias ytm="youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg" | |
| # Set PATHs and Homebrew | |
| export HOMEBREW_NO_ANALYTICS=1 | |
| export HOMEBREW_NO_INSECURE_REDIRECT=1 | |
| eval "$(rbenv init - zsh --no-rehash)" | |
| export PATH="$HOME/.composer/vendor/bin:$HOME/.rbenv/bin:$PATH" | |
| export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" | |
| export PHP_AUTOCONF=/usr/local/bin/autoconf | |
| export HOMEBREW_RUBY_PATH="$(which ruby)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment