Skip to content

Instantly share code, notes, and snippets.

@chew-z
Created February 19, 2017 16:18
Show Gist options
  • Save chew-z/f8ea45be8dd9b3a9b1b944bea33df293 to your computer and use it in GitHub Desktop.
Save chew-z/f8ea45be8dd9b3a9b1b944bea33df293 to your computer and use it in GitHub Desktop.
My .zshenv
# LOCALE SETTINGS
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
# LC_ALL overwrites all other variables
export LC_ALL=en_US.UTF-8
# PATH
# http://stackoverflow.com/questions/6555751/
# system-wide environment settings for zsh(1)
# if [ -x /usr/libexec/path_helper ]; then
# eval `/usr/libexec/path_helper -s`
# fi
if [ -x /usr/libexec/path_helper ]; then
PATH=""
eval `/usr/libexec/path_helper -s`
fi
export PATH="/usr/local/sbin:$PATH"
# export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"
# To opt out of Homebrew's analytics, using Google Analytics
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSECURE_REDIRECT=1
# add coreutils brew version
# GNU Coreutils contains the most essential UNIX commands, such as ls, cat.
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
# make pkg-config to use OpenSSL
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:/usr/local/lib/pkgconfig
#
# zsh-completitions & functions (also brew installed)
fpath=(
/usr/local/share/zsh-completions
/usr/local/share/zsh/site-functions
$fpath
)
#
# ZSH OPTIONS EXPLICITE
# http://zsh.sourceforge.net/Doc/Release/Options.html
# why would you type 'cd dir' if you could just type 'dir'?
setopt AUTO_CD
# Now we can pipe to multiple outputs!
setopt MULTIOS
# Spell check commands! (Sometimes annoying)
# setopt CORRECT
# This makes cd=pushd
setopt AUTO_PUSHD
# This will use named dirs when possible
setopt AUTO_NAME_DIRS
# If we have a glob this will expand it
setopt GLOB_COMPLETE
# No need to quote urls containing '?' with youtube-dl
unsetopt NOMATCH
#
setopt PUSHD_MINUS
# No more annoying pushd messages...
# setopt PUSHD_SILENT
# blank pushd goes to home
setopt PUSHD_TO_HOME
# this will ignore multiple directories for the stack. Useful? I dunno.
setopt PUSHD_IGNORE_DUPS
# 10 second wait if you do something that will delete everything. I wish I'd had this before...
# not active when rm = trash
setopt RM_STAR_WAIT
# use magic (this is default, but it can't hurt!)
# setopt ZLE
setopt NO_HUP
# Disables Ctrl+D
# setopt IGNORE_EOF
# If I could disable Ctrl-s completely I would!
setopt NO_FLOW_CONTROL
# beeps are annoying
setopt NO_BEEP
# Keep echo "station" > station from clobbering station
setopt NO_CLOBBER
# Case insensitive globbing
setopt NO_CASE_GLOB
# Be Reasonable!
setopt NUMERIC_GLOB_SORT
# I don't know why I never set this before.
setopt EXTENDED_GLOB
# hows about arrays be awesome? (that is, frew${cool}frew has frew surrounding all the variables, not just first and last
setopt RC_EXPAND_PARAM
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="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"
#
# Add the following to your zshrc to access the online help
export MANPATH="/usr/local/man:$MANPATH"
unalias run-help
autoload run-help
HELPDIR=/usr/local/share/zsh/help
#
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# History file location (oh-my-zsh default) ~/.zsh_history
HISTFILE=${HOME}/.zsh_history
# Make my history much longer
export HISTSIZE=32768
export SAVEHIST=$HISTSIZE
# there is no equivalent of bash's HISTIGNORE in zsh
# export HISTIGNORE="ls*:ytl*:youtube-dl*:which*:cd*:"
# HIST_IGNORE_DUPS removes duplicates only if they are consecutive commands.
# To eliminate across the whole history, set the HISTCONTROL to erasedups
export HISTCONTROL='erasedups'
# Don't overwrite, append!
setopt APPEND_HISTORY
# Write after each command
setopt INC_APPEND_HISTORY
# Killer: share history between multiple shells
setopt SHARE_HISTORY
# If I type cd and then cd again, only save the last one
setopt HIST_IGNORE_DUPS
# Even if there are commands inbetween commands that are the same, still only save the last one
setopt HIST_IGNORE_ALL_DUPS
# Pretty Obvious. Right?
setopt HIST_REDUCE_BLANKS
# If a line starts with a space, don't save it.
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
# When using a hist thing, make a newline show the change before executing it.
setopt HIST_VERIFY
# Save the time and how long a command ran
setopt EXTENDED_HISTORY
setopt HIST_SAVE_NO_DUPS
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
# share history between sessions
setopt SHARE_HISTORY
# add commands as they are typed, don't wait until shell exit
setopt INC_APPEND_HISTORY
#
# we are using custom mvim shell script
export VIM_APP_DIR="/Applications"
# Preferred editor for local and remote sessions
export EDITOR='subl -w'
# !!! setting vim as EDITOR has side/sad effects of mapping vi mode in zsh !!!
# http://unix.stackexchange.com/questions/197839/
# setopt vi resets TAB key binding breaking fzf. No go for me!
# Set mvim_editor.sh/MacVim as EDITOR.
# if [ -f "$HOME/Documents/Shell/mvim_editor.sh" ]; then
# export EDITOR="$HOME/Documents/Shell/mvim_editor.sh"
# else
# echo "WARNING: Can't find mveditor. Using vim instead."
# export EDITOR="/Applications/MacVim.app/Contents/MacOS/Vim"
# fi
# ssh
export SSH_KEY_PATH="${HOME}/.ssh/id_rsa"
# Mail - mu, offlineimap
export MAILDIR="${HOME}/.Mail"
# pip should only run if there is a virtualenv currently activated
# https://hackercodex.com/guide/python-development-environment-on-mac-osx/
export PIP_REQUIRE_VIRTUALENV=true
# brew OpenSSL
# export SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem
# alias openssl=/usr/local/opt/openssl/bin/openssl
# brew curl
alias curl=/usr/local/opt/curl/bin/curl
#
# proxy polipo or privoxy
# skip polipo - no cache
export {http,https,ftp}_proxy='http://localhost:8118'
# export http_proxy='localhost:8118'
# setting up Perl
PATH="$HOME/Documents/Perl/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="$HOME/Documents/Perl/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="$HOME/Documents/Perl/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"$HOME/Documents/Perl/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=$HOME/Documents/Perl/perl5"; export PERL_MM_OPT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment