diff options
author | zachir <zachir@librem.one> | 2022-10-05 22:00:32 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2022-10-05 22:00:32 -0500 |
commit | f39d735e2ba625a31a7dbf6fb8bdd62501379ad1 (patch) | |
tree | d17c96714c930e0b8bc75616cc9c81b961ed5aa0 /zsh/.zshrc |
Initial Commit
Diffstat (limited to 'zsh/.zshrc')
-rw-r--r-- | zsh/.zshrc | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..1c13e80 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,79 @@ +HISTFILE="$ZDOTDIR"/hist +SAVEHIST=1000 +HISTSIZE=1000 +setopt APPEND_HISTORY +setopt HIST_FIND_NO_DUPS +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_VERIFY +setopt HIST_IGNORE_DUPS +setopt INC_APPEND_HISTORY +setopt HIST_REDUCE_BLANKS + +if [ -f "$XDG_CONFIG_HOME"/sh/aliases ]; then + source "$XDG_CONFIG_HOME"/sh/aliases +fi +if [ -f "$XDG_CONFIG_HOME"/sh/functions ]; then + source "$XDG_CONFIG_HOME"/sh/functions +fi + +bindkey "^?" backward-delete-char + +# bindkey -v + +if [ "$TERM" = "st-256color" ] || [ "$TERM" = "xterm-256color" ]; then + function zle-line-init () { echoti smkx } + function zle-line-finish () { echoti rmkx } + + zle -N zle-line-init + zle -N zle-line-finish +fi + +which pacman >/dev/null && COLOR1="cyan" +which apt >/dev/null && COLOR1="green" +which syspatch >/dev/null && COLOR1="red" + +MYPROMPT='%B%F{'"$COLOR1"'}[%n@%m]:%f%F{white}%~%f%F{'"$COLOR1"'}%#%f%b ' +function zle-line-init zle-keymap-select { + VIM_PROMPT="%B%F{blue}[%n@%m]:%f%F{white}%~%f%F{blue}%#%f%b " + PS1="${${KEYMAP/vicmd/$VIM_PROMPT}/main/$MYPROMPT}" + #PS1="$PROMPT $KEYMAP" + zle reset-prompt +} + +zle -N zle-line-init +zle -N zle-keymap-select +export KEYTIMEOUT=1 + +autoload -Uz compinit promptinit +compinit -d $CONFIG/zcompdump +promptinit +autoload -Uz up-line-or-beginning-search down-line-or-beginning-search +zle -N up-line-or-beginning-search +zle -N down-line-or-beginning-search + +zstyle ':completion:*' menu select +zstyle ':completion::complete:*' gain-privileges 1 +zstyle ':completion:*' rehash true + +setopt COMPLETE_ALIASES +setopt AUTO_CD + +typeset -g -A key + +key[Up]="${terminfo[kcuu1]}" +key[Down]="${terminfo[kcud1]}" +key[Left]="${terminfo[kcub1]}" +key[Right]="${terminfo[kcuf1]}" +key[Shift-Tab]="${terminfo[kcbt]}" +key[Delete]="${terminfo[kdch1]}" + +[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-beginning-search +bindkey -- '^[[A' up-line-or-beginning-search +bindkey -- '^[[B' down-line-or-beginning-search +[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-beginning-search +[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char +[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete +[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char + +#eval "$(starship init zsh)" |