66 lines
2.0 KiB
Bash
66 lines
2.0 KiB
Bash
HISTFILE="$HOME/.zsh_history"
|
||
HISTSIZE=50000
|
||
SAVEHOST=50000
|
||
setopt share_history # persist, and share live across open shells
|
||
# setopt inc_append_history # history of session appended to HISTFILE after session ends
|
||
setopt extended_history # record timestamps
|
||
setopt hist_ignore_dups # drop a command identical to the one before it
|
||
setopt hist_ignore_space # don't record commands typed with a leading space
|
||
setopt hist_verify # let you edit a !-expansion before it runs
|
||
|
||
autoload -Uz compinit
|
||
compinit
|
||
|
||
autoload -Uz vcs_info
|
||
setopt prompt_subst
|
||
|
||
zstyle ':vcs_info:*' enable git
|
||
zstyle ':vcs_info:git:*' formats ' %F{yellow}‹%b› %f'
|
||
zstyle ':vcs_info:git:*' actionformats ' %F{yellow}‹%b|%a› %f'
|
||
|
||
zstyle ':vcs_info:git*+set-message:*' hooks git-dirty
|
||
+vi-git-dirty() {
|
||
if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
|
||
hook_com[branch]+='%F{red}●%F{yellow}'
|
||
fi
|
||
}
|
||
|
||
precmd() { vcs_info }
|
||
|
||
PROMPT='╭─%B%(!.%F{red}.%F{green})%n@%m%f %F{blue}%~%f%b${vcs_info_msg_0_}
|
||
╰─%B%(!.#.$)%b '
|
||
RPROMPT='%B%(?..%F{red}%? ↵%f)%b'
|
||
|
||
expand-or-complete-with-dots() {
|
||
print -Pn '%F{red}…%f'
|
||
zle expand-or-complete
|
||
zle redisplay
|
||
}
|
||
zle -N expand-or-complete-with-dots
|
||
bindkey '^I' expand-or-complete-with-dots
|
||
|
||
# Preferred editor for local and remote sessions
|
||
if [[ -n $SSH_CONNECTION ]]; then
|
||
export EDITOR='vim'
|
||
else
|
||
export EDITOR='nvim'
|
||
fi
|
||
|
||
export DOTFILES_ZSH_DIR="$HOME/dotfiles/roles/zsh/files"
|
||
|
||
for zsh_file in "$DOTFILES_ZSH_DIR"/*.zsh; do
|
||
[[ -r "$zsh_file" ]] && source "$zsh_file"
|
||
done
|
||
|
||
ZSH_PLUGINS_DIR="$HOME/.zsh/plugins"
|
||
source "$ZSH_PLUGINS_DIR/zsh_autosuggestions/zsh-autosuggestions.zsh"
|
||
source "$ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
|
||
|
||
bindkey '^H' backward-kill-word # Ctrl+Backspace - delete word
|
||
bindkey '^[[3;5~' kill-word # Ctrl+Delete - delete forward word
|
||
bindkey '^[[1;5C' forward-word # Ctrl+Right - jump forward a word
|
||
bindkey '^[[1;5D' backward-word # Ctrl+Left - jump backward a word
|
||
|
||
eval "$(zoxide init zsh)"
|
||
|