.zshrc (2150B)
1 # .zshrc 2 3 # History. 4 [[ ! -d "$XDG_CACHE_HOME/zsh" ]] && mkdir -p "$XDG_CACHE_HOME/zsh" 5 HISTFILE="$XDG_CACHE_HOME/zsh/zsh_histfile" 6 HISTSIZE=10000 7 SAVEHIST=10000 8 9 # Write history command-by-command, don't overwrite. 10 setopt INC_APPEND_HISTORY 11 12 # Treat '#', '~', and '^' as part of patterns for filename generation. 13 setopt EXTENDED_GLOB 14 15 # vi-mode. 16 bindkey -v 17 bindkey '^Y' push-line 18 bindkey '^R' history-incremental-search-backward 19 20 # Add zsh completion definition dirs. 21 fpath=("$HOME/.local/zsh/site-functions" "$ZDOTDIR/site-functions" "${fpath[@]}") 22 23 # Specify where compinstall writes cfg commands. Default, but saves checks. 24 zstyle ':compinstall' filename "$ZDOTDIR/.zshrc" 25 26 # Use menu-style autocompletion. 27 zstyle ':completion:*' menu select 28 29 # Initialize completion for current session. 30 autoload -Uz compinit && compinit 31 32 # Current git branch (for prompt). 33 git_branch() { 34 local branch 35 branch="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" 36 if [[ -n $branch ]]; then 37 echo -n " ($branch)" 38 fi 39 } 40 41 # Prompt. 42 setopt prompt_subst 43 autoload -Uz colors && colors 44 PROMPT='%{$fg[yellow]%}%T %{$fg[green]%}%n@%m%{$reset_color%}:%{$fg_bold[blue]%}%c%{$fg[yellow]%}$(git_branch)%{$reset_color%}%# ' 45 46 # Set TERM for known terminals, and as a fallback when specified term is 47 # unavailable. 48 term_bin="" 49 if [[ -e /proc/$PPID/cmdline ]]; then 50 term_bin="${$(</proc/$PPID/cmdline):t}" 51 fi 52 if [[ "$COLORTERM" == "gnome-terminal" ]] || \ 53 [[ "$term_bin" == gnome-terminal* ]] || \ 54 [[ "$TERM" == "xterm-256color-italic" && ! $(tput -T"$TERM" longname > /dev/null 2>&1) ]]; then 55 export TERM=xterm-256color 56 fi 57 unset term_bin 58 59 # Load path additions. 60 if [ -f "$XDG_CONFIG_HOME/zsh/paths" ]; then 61 . "$XDG_CONFIG_HOME/zsh/paths" 62 fi 63 64 # Load aliases. 65 if [ -f "$XDG_CONFIG_HOME/zsh/aliases" ]; then 66 . "$XDG_CONFIG_HOME/zsh/aliases" 67 fi 68 69 # Load colour support. 70 if [ -f "$XDG_CONFIG_HOME/zsh/colors" ]; then 71 . "$XDG_CONFIG_HOME/zsh/colors" 72 fi 73 74 # Load custom functions. 75 if [ -f "$XDG_CONFIG_HOME/zsh/functions" ]; then 76 . "$XDG_CONFIG_HOME/zsh/functions" 77 fi 78 79 # Load tools. 80 if [ -f "$XDG_CONFIG_HOME/zsh/tools" ]; then 81 . "$XDG_CONFIG_HOME/zsh/tools" 82 fi