# Correct spelling for commands setopt correct # turn off the infernal correctall for filenames unsetopt correctall # start zgen if [ -f ~/.zgenrc ]; then source ~/.zgenrc fi # set some history options setopt append_history setopt extended_history setopt hist_expire_dups_first setopt hist_ignore_all_dups setopt hist_ignore_dups setopt hist_ignore_space setopt hist_reduce_blanks setopt hist_save_no_dups setopt hist_verify # Share your history across all your terminal windows setopt share_history #setopt noclobber # set some more options setopt pushd_ignore_dups #setopt pushd_silent # Keep a ton of history. HISTSIZE=100000 SAVEHIST=100000 HISTFILE=~/.zsh_history export HISTIGNORE="ls:cd:cd -:pwd:exit:date:* --help" # Long running processes should return time after they complete. Specified # in seconds. REPORTTIME=2 TIMEFMT="%U user %S system %P cpu %*Es total" # How often to check for an update. If you want to override this, the # easiest way is to add a script fragment in ~/.zshrc.d that unsets # QUICKSTART_KIT_REFRESH_IN_DAYS. QUICKSTART_KIT_REFRESH_IN_DAYS=7 # Expand aliases inline - see http://blog.patshead.com/2012/11/automatically-expaning-zsh-global-aliases---simplified.html globalias() { if [[ $LBUFFER =~ ' [A-Z0-9]+$' ]]; then zle _expand_alias zle expand-word fi zle self-insert } zle -N globalias bindkey " " globalias bindkey "^ " magic-space # control-space to bypass completion bindkey -M isearch " " magic-space # normal space during searches # Stuff only tested on zsh, or explicitly zsh-specific if [ -r ~/.zsh_aliases ]; then source ~/.zsh_aliases fi # deal with screen, if we're using it - courtesy MacOSXHints.com # Login greeting ------------------ if [ "$TERM" = "screen" -a ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then detached_screens=$(screen -list | grep Detached) if [ ! -z "$detached_screens" ]; then echo "+---------------------------------------+" echo "| Detached screens are available: |" echo "$detached_screens" echo "+---------------------------------------+" fi fi # Speed up autocomplete, force prefix mapping zstyle ':completion:*' accept-exact '*(N)' zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)*==34=34}:${(s.:.)LS_COLORS}")'; # Load any custom zsh completions we've installed if [ -d ~/.zsh-completions ]; then for completion in ~/.zsh-completions/* do source "$completion" done fi # Make it easy to append your own customizations that override the above by # loading all files from the ~/.zshrc.d directory mkdir -p ~/.zshrc.d if [ -n "$(/bin/ls ~/.zshrc.d)" ]; then for dotfile in ~/.zshrc.d/* do if [ -r "${dotfile}" ]; then source "${dotfile}" fi done fi # In case a plugin adds a redundant path entry, remove duplicate entries # from PATH # # This snippet is from Mislav Marohnić 's # dotfiles repo at https://github.com/mislav/dotfiles dedupe_path() { typeset -a paths result paths=($path) while [[ ${#paths} -gt 0 ]]; do p="${paths[1]}" shift paths [[ -z ${paths[(r)$p]} ]] && result+="$p" done export PATH=${(j+:+)result} } dedupe_path # Do selfupdate checking. We do this after processing ~/.zshrc.d to make the # refresh check interval easier to customize. # # If they unset QUICKSTART_KIT_REFRESH_IN_DAYS in one of the fragments # in ~/.zshrc.d, then we don't do any selfupdate checking at all. _load-lastupdate-from-file() { local now=$(date +%s) if [[ -f "${1}" ]]; then local last_update=$(cat "${1}") else local last_update=0 fi local interval="$(expr ${now} - ${last_update})" echo "${interval}" } _update-zsh-quickstart() { if [[ ! -L ~/.zshrc ]]; then echo ".zshrc is not a symlink, skipping zsh-quickstart-kit update" else local _link_loc=$(readlink ~/.zshrc); if [[ "${_link_loc/${HOME}}" == "${_link_loc}" ]] then pushd $(dirname "${HOME}/$(readlink ~/.zshrc)"); else pushd $(dirname ${_link_loc}); fi; local gitroot=$(git rev-parse --show-toplevel) if [[ -f "${gitroot}/.gitignore" ]]; then if [[ $(grep -c zsh-quickstart-kit "${gitroot}/.gitignore") -ne 0 ]]; then echo "---- updating ----" git pull date +%s >! ~/.zsh-quickstart-last-update fi else echo 'No quickstart marker found, is your quickstart a valid git checkout?' fi popd fi } _check-for-zsh-quickstart-update() { local day_seconds=$(expr 24 \* 60 \* 60) local refresh_seconds=$(expr "${day_seconds}" \* "${QUICKSTART_KIT_REFRESH_IN_DAYS}") local last_quickstart_update=$(_load-lastupdate-from-file ~/.zsh-quickstart-last-update) if [ ${last_quickstart_update} -gt ${refresh_seconds} ]; then echo "It has been $(expr ${last_quickstart_update} / ${day_seconds}) days since your zsh quickstart kit was updated" echo "Checking for zsh-quickstart-kit updates..." _update-zsh-quickstart fi } # # if [[ ! -z "$QUICKSTART_KIT_REFRESH_IN_DAYS" ]]; then # _check-for-zsh-quickstart-update # unset QUICKSTART_KIT_REFRESH_IN_DAYS # fi POWERLEVEL9K_MODE='nerdfont-complete' #POWERLEVEL9K_SHORTEN_DIR_LENGTH=1 #POWERLEVEL9K_SHORTEN_DELIMITER="" #POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right" POWERLEVEL9K_PROMPT_ON_NEWLINE=true POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR='' POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR='' POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR='' POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR='' POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%F{white}" POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%F{white} " POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(root_indicator dir dir_writable_joined) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time vcs background_jobs_joined time_joined) POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear" POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear" POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow" POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="yellow" POWERLEVEL9K_DIR_HOME_BACKGROUND="clear" POWERLEVEL9K_DIR_HOME_FOREGROUND="blue" POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="clear" POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="blue" POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="clear" POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="red" POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="clear" POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white" POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="white" POWERLEVEL9K_STATUS_OK_BACKGROUND="clear" POWERLEVEL9K_STATUS_OK_FOREGROUND="green" POWERLEVEL9K_STATUS_ERROR_BACKGROUND="clear" POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red" POWERLEVEL9K_TIME_BACKGROUND="clear" POWERLEVEL9K_TIME_FOREGROUND="cyan" POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear' POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='magenta' POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND='clear' POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND='green' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=250" # 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" # You may need to manually set your language environment #export LANG=en_US.UTF-8 # Set personal aliases, overriding those provided by oh-my-zsh libs, # plugins, and themes. Aliases can be placed here, though oh-my-zsh # users are encouraged to define aliases within the ZSH_CUSTOM folder. # For a full list of active aliases, run `alias`. # # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" source $HOME/.zsh_aliases #PS1='[\u@\h \W]\$ ' # >>> Added by cnchi installer BROWSER=/usr/bin/chromium EDITOR=/usr/bin/micro . ~/.ssh/.ssh-find-agent.sh ssh-find-agent -a if [ -z "$SSH_AUTH_SOCK" ] then eval $(ssh-agent) > /dev/null ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh' fi export GOPATH="$HOME/Code/go" export PATH="$PATH:$GOPATH/bin"