# vim: filetype=zsh # load colors and set up prompt autoload -U colors && colors setopt PROMPT_SUBST # prompt git-head-abbrev() { c="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" if [ "$c" = "HEAD" ]; then c="$(git describe --tags 2>/dev/null)" [ -z "$c" ] && c="$(git rev-parse --short HEAD 2>/dev/null)" fi [ -n "$c" ] && printf " ($c)" } PS1='%B%{$fg[magenta]%}%n%{$fg[blue]%}@%{$fg[green]%}%m %{$fg[yellow]%}%~%b%{$fg[cyan]%}$(git-head-abbrev)%{$fg[red]%}%(!.#.$)%{$reset_color%} ' # set up history and history file HISTSIZE=100000 SAVEHIST=100000 HISTFILE=~/.cache/zsh/history setopt HIST_IGNORE_DUPS setopt HIST_FIND_NO_DUPS setopt EXTENDED_HISTORY # set up navigation menu when pressing tab multiple times autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist compinit -d ~/.cache/zsh/zcompdump #_comp_options+=(globdots) # auto complete case insensitive zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' # set up vi style keys bindkey -v export KEYTIMEOUT=1 # also set vi keys to navigate the menus when double pressing tab bindkey -M menuselect 'h' vi-backward-char bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char bindkey -M menuselect 'j' vi-down-line-or-history [ -f "$XDG_CONFIG_HOME/zsh/aliases" ] && source "$XDG_CONFIG_HOME/zsh/aliases" [ -f "$XDG_CONFIG_HOME/zsh/host-$(hostname -s)" ] && source "$XDG_CONFIG_HOME/zsh/host-$(hostname -s)" # source fzf key bindings if [ -f "/usr/share/fzf/key-bindings.zsh" ]; then # arch source "/usr/share/fzf/key-bindings.zsh" 2> /dev/null elif [ -f "/usr/share/doc/fzf/examples/key-bindings.zsh" ]; then # debian source "/usr/share/doc/fzf/examples/key-bindings.zsh" 2> /dev/null elif [ -f "/usr/share/fzf/shell/key-bindings.zsh" ]; then # fedora source "/usr/share/fzf/shell/key-bindings.zsh" 2> /dev/null fi # highlighting plug-in if [ -f "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then # arch and debian source "/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 2> /dev/null elif [ -f "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]; then # fedora source "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 2> /dev/null fi