Files
dotfiles/zsh/.zshrc
2022-03-01 15:10:06 +01:00

86 lines
2.0 KiB
Bash

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
autoload -Uz vcs_info
HISTFILE=${HOME}/.zsh_history
HISTSIZE=100000
SAVEHIST=$HISTSIZE
setopt completeinword
setopt extended_glob
setopt noflowcontrol
setopt prompt_subst
unsetopt nomatch
setopt share_history
setopt append_history
setopt extended_history
setopt histignorealldups
setopt histignorespace
setopt histfcntllock
bindkey -e
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() {
echoti smkx
}
function zle-line-finish() {
echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish
fi
[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line
[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line
[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char
zstyle ':completion:*:commands' rehash 1
zstyle ':completion:*' completer _oldlist _expand _complete _files _ignored
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' menu select=2
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats "[%B%F{cyan}%b%f%%b]"
zstyle ':vcs_info:*' actionformats "[%B%F{cyan}%b%f%%b|%a]"
local shell_indicator=""
[[ -f /run/.containerenv && -f /run/.toolboxenv ]] && shell_indicator="%F{13}⬢%f "
local user_color="red"
let $UID && user_color="13"
local user="%B%F{${user_color}}%n%f%b"
local at="@"
local host="%B%m%b "
local dollar="%F{red}%(#~#~$)%f "
local percent="%# "
local rc="%B%F{red}%(?..%? )%f%b"
local dir="%(4~|.../%2~|%~) "
PROMPT="${shell_indicator}${user}${at}${host}${dir}${dollar}"
RPROMPT="\$vcs_info_msg_0_"
precmd () {
print -Pn "\e]0;%n@%m: %~\a"
vcs_info
}
preexec () {
print -Pn "\e]0;%n@%m: $1\a"
}
sshl() {
ssh -N -L ${1}:localhost:${2} $3
}
alias :q="exit"
alias ..="cd .."
[[ -x /usr/bin/xdg-open ]] && alias open="xdg-open"