104 lines
2.9 KiB
Bash
104 lines
2.9 KiB
Bash
# set options
|
|
setopt correct
|
|
setopt auto_cd
|
|
setopt prompt_subst
|
|
|
|
# vi-mode
|
|
bindkey -v
|
|
|
|
# history
|
|
export HISTFILE="$HOME/.zsh_history"
|
|
export HISTSIZE=1000
|
|
export SAVEHIST=1000
|
|
setopt SHARE_HISTORY
|
|
|
|
# add path to $fpath
|
|
fpath=("$HOME/.zsh/functions/prompts" $fpath)
|
|
|
|
# load extentions
|
|
autoload -U compinit promptinit url-quote-magic colors zsh/terminfo
|
|
|
|
# quote pasted URLs
|
|
zle -N self-insert url-quote-magic
|
|
|
|
# prompt
|
|
promptinit
|
|
prompt pure
|
|
|
|
# tab completion
|
|
compinit
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
|
|
|
# colors
|
|
eval $(dircolors -b)
|
|
|
|
# color man
|
|
export LESS_TERMCAP_mb=$'\E[01;31m'
|
|
export LESS_TERMCAP_md=$'\E[01;38;5;74m'
|
|
export LESS_TERMCAP_me=$'\E[0m'
|
|
export LESS_TERMCAP_se=$'\E[0m'
|
|
export LESS_TERMCAP_so=$'\E[38;33;246m'
|
|
export LESS_TERMCAP_ue=$'\E[0m'
|
|
export LESS_TERMCAP_us=$'\E[04;38;5;146m'
|
|
|
|
# create a zkbd compatible hash;
|
|
typeset -A key
|
|
|
|
key[Home]=${terminfo[khome]}
|
|
|
|
key[End]=${terminfo[kend]}
|
|
key[Insert]=${terminfo[kich1]}
|
|
key[Delete]=${terminfo[kdch1]}
|
|
key[Up]=${terminfo[kcuu1]}
|
|
key[Down]=${terminfo[kcud1]}
|
|
key[Left]=${terminfo[kcub1]}
|
|
key[Right]=${terminfo[kcuf1]}
|
|
key[PageUp]=${terminfo[kpp]}
|
|
key[PageDown]=${terminfo[knp]}
|
|
|
|
# setup key accordingly
|
|
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
|
|
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
|
|
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
|
|
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
|
|
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
|
|
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
|
|
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
|
|
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
|
|
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
|
|
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
|
|
|
|
# Finally, make sure the terminal is in application mode, when zle is
|
|
# active. Only then are the values from $terminfo valid.
|
|
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
|
function zle-line-init () {
|
|
printf '%s' "${terminfo[smkx]}"
|
|
}
|
|
function zle-line-finish () {
|
|
printf '%s' "${terminfo[rmkx]}"
|
|
}
|
|
zle -N zle-line-init
|
|
zle -N zle-line-finish
|
|
fi
|
|
|
|
# syntax highlighting
|
|
source "$HOME/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
|
# history substring search
|
|
source "$HOME/.zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh"
|
|
|
|
# bind keys to history substring search
|
|
zmodload zsh/terminfo
|
|
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
|
bindkey "$terminfo[kcud1]" history-substring-search-down
|
|
|
|
# alias
|
|
alias pacupg='sudo pacman -Syu'
|
|
alias ls='ls --color=auto -lh'
|
|
alias l='ls'
|
|
|
|
# run ls after directory change
|
|
function chpwd() {
|
|
emulate -L zsh
|
|
ls
|
|
}
|