126 lines
4.2 KiB
Bash
126 lines
4.2 KiB
Bash
################################
|
|
# _ #
|
|
# | | #
|
|
# _______| |__ _ __ ___ #
|
|
# |_ / __| '_ \| '__/ __| #
|
|
# / /\__ \ | | | | | (__ #
|
|
# /___|___/_| |_|_| \___| #
|
|
# #
|
|
################################
|
|
|
|
# Autoload stuff
|
|
autoload -U compinit promptinit
|
|
compinit
|
|
promptinit
|
|
|
|
# History
|
|
export HISTSIZE=100000
|
|
export HISTFILE="$HOME/.history"
|
|
export SAVEHIST=$HISTSIZE
|
|
setopt hist_ignore_all_dups
|
|
setopt hist_ignore_space
|
|
|
|
# Promptstyle
|
|
prompt walters
|
|
|
|
# Autocomplete stuff
|
|
zstyle ':completion:*' menu select
|
|
setopt completealiases
|
|
typeset -A key
|
|
|
|
# Key settings
|
|
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]}
|
|
|
|
# Key bindings
|
|
[[ -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
|
|
[[ -n ${key[Backspace]} ]] && bindkey "${key[Backspace]}" backward-delete-char
|
|
[[ -n ${key[Insert]} ]] && bindkey "${key[Insert]}" overwrite-mode
|
|
[[ -n ${key[Home]} ]] && bindkey "${key[Home]}" beginning-of-line
|
|
[[ -n ${key[PageUp]} ]] && bindkey "${key[PageUp]}" up-line-or-history
|
|
[[ -n ${key[Delete]} ]] && bindkey "${key[Delete]}" delete-char
|
|
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
|
[[ -n ${key[PageDown]} ]] && bindkey "${key[PageDown]}" down-line-or-history
|
|
[[ -n ${key[Up]} ]] && bindkey "${key[Up]}" up-line-or-search
|
|
[[ -n ${key[Left]} ]] && bindkey "${key[Left]}" backward-char
|
|
[[ -n ${key[Down]} ]] && bindkey "${key[Down]}" down-line-or-search
|
|
[[ -n ${key[Right]} ]] && bindkey "${key[Right]}" forward-char
|
|
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" history-beginning-search-backward
|
|
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" history-beginning-search-forward
|
|
|
|
bindkey "[C" forward-word
|
|
bindkey "[D" backward-word
|
|
|
|
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
|
|
|
|
DIRSTACKFILE="$HOME/.cache/zsh/dirs"
|
|
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then
|
|
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )
|
|
[[ -d $dirstack[1] ]] && cd $dirstack[1]
|
|
fi
|
|
|
|
chpwd() {
|
|
print -l $PWD ${(u)dirstack} > $DIRSTACKFILE
|
|
}
|
|
|
|
DIRSTACKSIZE=20
|
|
|
|
# Colored manpages
|
|
man() {
|
|
env \
|
|
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
|
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
|
LESS_TERMCAP_me=$(printf "\e[0m") \
|
|
LESS_TERMCAP_se=$(printf "\e[0m") \
|
|
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
|
|
LESS_TERMCAP_ue=$(printf "\e[0m") \
|
|
LESS_TERMCAP_us=$(printf "\e[1;32m") \
|
|
man "$@"
|
|
}
|
|
|
|
alias ll="ls -l"
|
|
alias llm='ls -al | more'
|
|
alias ls='ls --color=auto'
|
|
alias grep='grep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
alias diff='colordiff'
|
|
alias ports='netstat -tulanp'
|
|
alias cal='cal -m'
|
|
|
|
setopt autopushd pushdsilent pushdtohome
|
|
setopt pushdignoredups
|
|
setopt pushdminus
|
|
setopt nohashdirs
|
|
#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
rehash
|
|
|
|
source <(oc completion zsh)
|
|
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
|