conf/.zshrc

80 lines
2.0 KiB
Bash

#!/bin/zsh
# Initialize colors.
autoload -U colors
colors
# Allow for functions in the prompt.
setopt PROMPT_SUBST
# completion
autoload -U compinit
compinit
# completion style improvements
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
#zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
# correction
setopt correctall
# prompt
autoload -U promptinit
promptinit
prompt gentoo
export HISTSIZE=2048
# ignoring of duplicates
setopt hist_ignore_all_dups
# preventing particular entry from being recorded
setopt hist_ignore_space
# extended globbing
setopt extendedglob
PS1="[%*] %B%n@%F{green}%m%k%f:%B%F{blue}%1~%b%f%k%# "
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{28}✔'
zstyle ':vcs_info:*' unstagedstr '%F{11}✚'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git hg svn
precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{blue}]'
} else {
zstyle ':vcs_info:*' formats ' [%F{green}%b%c%u%F{red}✖%F{blue}]'
}
vcs_info
}
RPROMPT='%F{blue}${vcs_info_msg_0_}%F{blue} %(?/%F{blue}/%F{red})%{$reset_color%}'
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[4~" end-of-line # End
bindkey "\e[5~" beginning-of-history # PageUp
bindkey "\e[6~" end-of-history # PageDown
bindkey "\e[2~" quoted-insert # Ins
bindkey "\e[3~" delete-char # Del
bindkey "\e[5C" forward-word
bindkey "\eOc" emacs-forward-word
bindkey "\e[5D" backward-word
bindkey "\eOd" emacs-backward-word
bindkey "\e\e[C" forward-word
bindkey "\e\e[D" backward-word
bindkey "\e[Z" reverse-menu-complete # Shift+Tab
# for rxvt
bindkey "\e[7~" beginning-of-line # Home
bindkey "\e[8~" end-of-line # End
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
# for freebsd console
bindkey "\e[H" beginning-of-line
bindkey "\e[F" end-of-line