## OPTIONS # directories setopt autocd autopushd # zle parsing and globbing setopt interactive_comments rc_quotes extended_glob glob_star_short cbases octal_zeroes noclobber correct # history setopt hist_verify extended_history hist_expire_dups_first hist_ignore_dups hist_ignore_space share_history # default is 30 lines : ${HISTFILE=${XDG_CACHE_DIR:-$HOME/.cache}/zsh_history} SAVEHIST=10000 HISTSIZE=10000 ## PROMPTS # Command prompt # user@host ~/current/directory (job count) [exit status] # ā­ PS1=$'%(!.%B%F{red}%m%b.%F{magenta}%n@%m)%f:%F{blue}%~%f%(1j. %F{cyan}(%j%)%f.)%(?..%F{red} [%?]%f)\nā­ ' # Better looking correction and trace prompts SPROMPT='Correct %B%F{red}%U%R%b%f%u to %F{green}%r%f? [%By%bes|%BN%bo|%Be%bdit|%Ba%bbort] ' PS4='%F{black}: %F{magenta}%1N%f:%F{blue}%i%1(_.:%_.)%f; ' ## FUNCTIONS fpath+=("${ZDOTDIR:-${XDG_CONFIG_HOME:-$HOME/.config}/zsh}/functions") # Function distributed with Zsh, might as well autoload # - add-zsh-hook: needed below # - zargs: Similar to xargs, but uses inputs on the command line. # - zed: edit files inside ZLE # - zcalc: a REPL using ZLE and Zsh's arithmetic mode # - zmv: use glob patterns to perform bulk file operations autoload -Uz add-zsh-hook zed zargs zcalc zmv # Set window title to [PWD] - [command] - [terminal] .hook.title() { printf '\e]0;%s\a' "${(%):-${SSH_CONNECTION+%n@%m:}%~} āˆ’ ${1+$1 āˆ’ }${(C)${TERM_PROGRAM:-$TERM}}" } # Hooks add-zsh-hook precmd .hook.title add-zsh-hook preexec .hook.title ## DEFERRED COMPLETIONS autoload -Uz completion-setup zle -N expand-or-complete completion-setup ## COLORS # ls colors! eval "$(dircolors -b)" alias ls='ls --color=auto' # Other color aliases alias gcc='gcc -fdiagnostics-color=auto' ip='ip -color=auto' grep='grep --color=auto'