dotfiles/zshrc

101 lines
2.2 KiB
Bash
Raw Permalink Normal View History

2019-08-18 14:05:36 +02:00
# zmodload zsh/zprof
2021-01-30 22:16:43 +01:00
#
# Prompt
2019-08-18 02:07:17 +02:00
# https://github.com/sindresorhus/pure
2021-01-30 22:16:43 +01:00
#
2019-08-18 02:07:17 +02:00
autoload -U promptinit; promptinit
2019-08-19 00:37:26 +02:00
PURE_GIT_DOWN_ARROW=
PURE_GIT_UP_ARROW=
2021-01-30 22:16:43 +01:00
# PURE_PROMPT_SYMBOL=🦑
2019-08-18 02:07:17 +02:00
prompt pure
2021-01-30 22:16:43 +01:00
zstyle :prompt:pure:git:stash show yes
export CLICOLOR=1
2019-08-18 02:07:17 +02:00
2019-08-19 00:37:26 +02:00
CASE_SENSITIVE="true"
2019-08-18 02:07:17 +02:00
DISABLE_UPDATE_PROMPT="true"
DISABLE_AUTO_TITLE="true"
ENABLE_CORRECTION="true"
2019-08-19 00:37:26 +02:00
2021-02-16 20:23:47 +01:00
# Skip forward/back a word with opt-arrow
bindkey '^[f' forward-word
bindkey '^[b' backward-word
2021-01-30 22:16:43 +01:00
#
2019-08-19 00:37:26 +02:00
# History
2021-01-30 22:16:43 +01:00
#
2019-08-19 00:37:26 +02:00
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
2019-08-18 02:07:17 +02:00
HIST_STAMPS="yyyy-mm-dd"
2019-08-19 00:37:26 +02:00
HISTSIZE=50000
SAVEHIST=10000
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt inc_append_history
setopt share_history
2019-08-18 02:07:17 +02:00
2021-01-30 22:16:43 +01:00
#
2019-08-19 00:37:26 +02:00
# Changing directories
2021-01-30 22:16:43 +01:00
#
2019-08-19 00:37:26 +02:00
setopt auto_cd
setopt auto_pushd
unsetopt pushd_ignore_dups
setopt pushdminus
2021-01-30 22:16:43 +01:00
#
2019-08-19 00:37:26 +02:00
# Completion
2021-01-30 22:16:43 +01:00
#
2021-12-09 22:26:15 +01:00
autoload -Uz compinit
for dump in ~/.zcompdump(N.mh+24); do
compinit
done
compinit -C
2021-01-30 22:16:43 +01:00
2019-08-19 00:37:26 +02:00
setopt auto_menu
setopt always_to_end
setopt complete_in_word
unsetopt flow_control
unsetopt menu_complete
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
2019-08-18 14:05:36 +02:00
2019-10-25 00:38:46 +02:00
# Highlight the current autocomplete option
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Better SSH/SCP/Rsync Autocomplete
h=()
if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi
if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi
if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:(ssh|scp|rsync|slogin):*' hosts $h
fi
2023-01-23 19:05:14 +01:00
if [[ $(uname -m) == 'arm64' ]]; then
PATH_HOMEBREW=/opt/homebrew
else
PATH_HOMEBREW=/usr/local
fi
source $PATH_HOMEBREW/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $PATH_HOMEBREW/share/zsh-autosuggestions/zsh-autosuggestions.zsh
2021-01-30 22:16:43 +01:00
# source <(kubectl completion zsh)
2019-08-18 14:05:36 +02:00
2021-01-30 22:16:43 +01:00
#
# Other
#
setopt prompt_subst
2021-12-09 22:26:15 +01:00
source ~/.exports
source ~/.aliases
source ~/.private