Skip to content

Instantly share code, notes, and snippets.

@knz
Created August 3, 2022 13:55
Show Gist options
  • Save knz/52cf2fad98407da097715b4a12b2b5dd to your computer and use it in GitHub Desktop.
Save knz/52cf2fad98407da097715b4a12b2b5dd to your computer and use it in GitHub Desktop.
## -*- Shell-script -*-
##
## zshrc
##
umask 022
setopt correct
setopt auto_continue
setopt hist_ignore_dups
setopt bash_auto_list
setopt append_history
setopt rm_star_wait
setopt no_bg_nice
setopt complete_aliases
setopt equals
setopt extended_glob
setopt magic_equal_subst
setopt numericglobsort
setopt transient_rprompt
alias mv='nocorrect mv' # no spelling correction on mv
alias cp='nocorrect cp' # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
if [ -f $HOME/.dircolors ]; then
eval `dircolors $HOME/.dircolors`
fi
alias l='ls -l'
alias ll='ls -l'
alias la='ls -la'
[[ -t 1 ]] && {
chpwd() {
case $TERM in
sun-cmd) print -Pn "\e]l%n@%m %~\e\\" ;;
*xterm*|screen*|tmux*|rxvt|(k|E|dt)term) print -Pn "\e]0;%n@%m %~\a" ;;
esac
}
chpwd
}
export HISTSIZE=100
export HISTFILE=~/.zshhistory
export SAVEHIST=100
export LOGCHECK=60
export WATCHFMT="%n has %a %l from %M"
export WATCH=all
export NULLCMD=less
export LESS='-M -R'
RPROMPT='%(?,%B%T%b,%{%F{white}%}%{%F{blue}%}Err %?%{%f%}) %B#%h%b'
PROMPT='%{%F{white}%}%n@%m %{%F{cyan}%}%32<...<%~%{%f%} %# '
autoload zed
autoload insert-files
zle -N insert-files
bindkey -e
autoload nslookup
# Completion
autoload -U compinit
compinit
zstyle ':completion:*' format '%{%F{green}%}-=> %{%F{white}%}%d%{%f%}'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _complete _correct _approximate
zstyle ':completion:*' group-name ''
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'l:|=* r:|=*' 'r:|[
._-]=* r:|=*'
zstyle ':completion:*' max-errors 2
zstyle ':completion:*' menu select=5
zstyle ':completion:*' original true
zstyle ':completion:*' squeeze-slashes true
zstyle ':completion:*' verbose true
typeset -U hosts
hosts=()
[[ -r ~/.ssh/known_hosts ]] && {
hosts=($hosts ${${${${(f)"$(<~/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*})
}
[[ -r ~/.ssh/known_hosts2 ]] && {
hosts=($hosts ${${${${(f)"$(<~/.ssh/known_hosts2)"}:#[0-9]*}%%\ *}%%,*})
}
zstyle ':completion:*:hosts' hosts $hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment