You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
4.2 KiB
117 lines
4.2 KiB
#!/bin/zsh
|
|
|
|
#zinit installation if it's not there yet
|
|
ZINIT_HOME=$XDG_CONFIG_HOME/zsh/.zinit
|
|
|
|
if [[ ! -f $ZINIT_HOME/bin/zinit.zsh ]]; then
|
|
git clone https://github.com/zdharma/zinit $ZINIT_HOME/bin
|
|
zcompile $ZINIT_HOME/bin/zinit.zsh
|
|
fi
|
|
|
|
source "$ZINIT_HOME/bin/zinit.zsh"
|
|
autoload -Uz zinit
|
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
|
#end of installation
|
|
|
|
# PLUGINS
|
|
# usage see https://github.com/zdharma/zinit
|
|
|
|
zinit light zsh-users/zsh-autosuggestions
|
|
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=7'
|
|
source "$XDG_CONFIG_HOME/zsh/theme_current"
|
|
|
|
zinit light zdharma/fast-syntax-highlighting
|
|
zinit light chrissicool/zsh-256color
|
|
|
|
zinit ice wait"0b" lucid blockf
|
|
zinit light zsh-users/zsh-completions
|
|
|
|
zstyle ':completion:*' menu select # make menu list of matches
|
|
zstyle ':completion:::::' completer _expand _complete _ignored _approximate # be easy on typing errors
|
|
zstyle ':completion:*:approximate:*' max-errors 2 # limit errors for matches to 2
|
|
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # match uppercase from lowercase
|
|
zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" # use LS_COLORS for matches
|
|
|
|
autoload -U compinit && compinit #necessary to make completion work
|
|
|
|
#zinit snippet https://github.com/git/git/blob/master/contrib/completion/git-completion.zsh
|
|
|
|
## completion for kitty
|
|
kitty + complete setup zsh | source /dev/stdin
|
|
|
|
# THEME
|
|
zinit light agnoster/agnoster-zsh-theme
|
|
|
|
DEFAULT_USER=marc #für den Promot wird der user ausgeblendet, wenn default erkannt ist
|
|
|
|
export EDITOR=nvim
|
|
export VISUAL=nvim
|
|
|
|
setopt PROMPT_SUBST # erlaubt Funktionen im Prompt
|
|
setopt no_beep # no bell
|
|
|
|
# --------------------------------------
|
|
# History
|
|
# --------------------------------------
|
|
HISTFILE=$ZDOTDIR/zhistory
|
|
setopt APPEND_HISTORY # append hostory instead of overwriting
|
|
HISTSIZE=1200 # notwendig, damit HIST_EXPIRE_DUPS_FIRST funktioniert
|
|
SAVEHIST=1000
|
|
setopt HIST_EXPIRE_DUPS_FIRST # entfernt erst Duplikate, wenn SAVEHIST überläuft
|
|
setopt EXTENDED_HISTORY # speichert Zeitstempel und Dauer
|
|
setopt SHARE_HISTORY # share history across terms
|
|
|
|
# --------------------------------------
|
|
# Keybindings
|
|
# --------------------------------------
|
|
|
|
# create a zkbd compatible hash
|
|
# to add other keys to this hash, see: man 5 terminfo
|
|
|
|
typeset -A key
|
|
|
|
key[Home]="$terminfo[khome]"
|
|
key[End]="$terminfo[kend]"
|
|
key[Insert]="$terminfo[kich1]"
|
|
key[Backspace]="$terminfo[kbs]"
|
|
key[Delete]="$terminfo[kdch1]"
|
|
key[Up]="$terminfu[kcuu1]"
|
|
key[Down]="$terminfo[kcud1]"
|
|
key[Left]="$terminfo[kcub1]"
|
|
key[Right]="$terminfo[kcuf1]"
|
|
key[PageUp]="$terminfo[kpp]"
|
|
key[PageDown]="$terminfo[knp]"
|
|
key[Control-Left]="$terminfo[kLFT5]}"
|
|
key[Control-Right]="$terminfo[kRIT5]}"
|
|
|
|
# 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
|
|
[[ -n "${key[Control-Left]}" ]] && bindkey "${key[Control-Left]}" backward-word
|
|
[[ -n "${key[Control-Right]}" ]] && bindkey "${key[Control-Right]}" forward-word
|
|
bindkey "^R" history-incremental-search-backward
|
|
|
|
# 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 () {
|
|
echoti smkx
|
|
}
|
|
function zle-line-finish () {
|
|
echoti rmkx
|
|
}
|
|
zle -N zle-line-init
|
|
zle -N zle-line-finish
|
|
fi
|
|
|
|
|
|
|