This repository has been archived on 2023-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
2020-08-09 21:24:35 +01:00

71 lines
1.9 KiB
Bash

# General options
setopt autocd
setopt nobgnice # Run bg jobs at normal priority
setopt nonotify # Don't notify when bg jobs complete
setopt nobeep
# History config
HISTFILE="${XDG_CACHE_HOME:-${HOME}/.cache}/zsh/history"
HISTSIZE=10000
SAVEHIST=10000
[[ !( -f "${HISTFILE}" ) ]] && mkdir -p $(dirname ${HISTFILE})
setopt HIST_IGNORE_DUPS
# Completion
autoload -Uz compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files
# Vi keybindings
bindkey -v
bindkey -v '^?' backward-delete-char
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey '^[[P' delete-char
export KEYTIMEOUT=1
# Colors
autoload -U colors && colors
# Prompt
PS1="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
zle-keymap-select() {
if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then
echo -ne '\e[1 q'
elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
}
zle-line-init() {
# zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
echo -ne "\e[5 q"
}
zle -N zle-keymap-select
zle -N zle-line-init
echo -ne '\e[5 q' # Beam cursor on startup
preexec() { echo -ne '\e[5 q' ;} # Beam cursor for new prompts
# Aliases
source "${XDG_CONFIG_HOME:-${HOME}/.config}/.aliasrc"
# Autosuggest
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
# Highlighting
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
# History substring search
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.plugin.zsh