zsh/zshrc

198 lines
5.9 KiB
Bash
Raw Normal View History

2020-04-01 16:39:01 +00:00
# if using zgen must do 'zgen reset' after any changes to this file
2020-02-27 14:46:48 +00:00
emulate sh
source "${HOME}/.profile"
emulate zsh
autoload -Uz compinit
autoload -Uz colors
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
if [ $(date +'%j') != $updated_at ]; then
compinit -i
else
compinit -C -i
fi
2020-04-01 16:39:01 +00:00
# https://wiki.archlinux.org/index.php/Zsh#xterm_title
autoload -Uz add-zsh-hook
function xterm_title_precmd () {
print -Pn -- '\e]2;%n@%m %~\a'
[[ "$TERM" == 'screen'* ]] && print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-}\e\\'
}
function xterm_title_preexec () {
print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
[[ "$TERM" == 'screen'* ]] && { print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-} \005{B}%~\005{-} %# ' && print -n -- "${(q)1}\e\\"; }
}
if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
add-zsh-hook -Uz precmd xterm_title_precmd
add-zsh-hook -Uz preexec xterm_title_preexec
fi
2020-02-27 14:46:48 +00:00
# zgen
# https://github.com/tarjoilija/zgen
# after changes must do:
# zgen reset
# to remove static init script
source "${HOME}/.config/zsh/zgen/zgen.zsh"
# if the init script doesn't exist
if ! zgen saved; then
# specify plugins here
# zgen oh-my-zsh
zgen load denysdovhan/spaceship-prompt spaceship
zgen load zdharma/fast-syntax-highlighting
zgen load zsh-users/zsh-autosuggestions
zgen load zsh-users/zsh-history-substring-search
zgen load zsh-users/zsh-completions
zgen load wbingli/zsh-wakatime
zgen load peterhurford/up.zsh
zgen load supercrabtree/k
zgen load laggardkernel/git-ignore
zgen load AlexisBRENON/oh-my-zsh-reminder # commands todo, task_done -> todone
# zsh-fast-alias-tips
# Before using need to run 'make build'
# in plugin directory '~/.zgen/sei40kr/zsh-fast-alias-tips-master/'
# zgen load sei40kr/zsh-fast-alias-tips
# generate the init script from plugins above
zgen save
fi
# HISTFILE=~/.histfile
# HISTSIZE=10000
# SAVEHIST=$HISTSIZE
setopt hist_ignore_all_dups # remove older duplicate entries from history
setopt hist_reduce_blanks # remove superfluous blanks from history items
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances of the shell
setopt auto_cd # cd by typing directory name if it's not a command
setopt correct_all # autocorrect commands
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt always_to_end # move cursor to end if word had one match
unsetopt BEEP
zstyle ':completion:*' menu select # select completions with arrow keys
zstyle ':completion:*' group-name '' # group results by category
zstyle ':completion:::::' completer _expand _complete _ignored _approximate # enable approximate matches
bindkey -v
# The following line was added by compinstall
zstyle :compinstall filename '/home/ray/.zshrc'
zmodload -i zsh/complist
zstyle ':completion:*' menu select
zmodload zsh/complist
# use the vi navigation keys in menu completion
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
# zsh-history-subsrting-search settings
HISTORY_SUBSTRING_SEARCH_FUZZY=true
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '' history-substring-search-up
bindkey '' history-substring-search-down
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=239'
#zsh-autosuggestion settings
bindkey '^f' autosuggest-accept
SPACESHIP_TIME_SHOW=true
SPACESHIP_NODE_SYMBOL=node-
SPACESHIP_PACKAGE_PREFIX=
SPACESHIP_PACKAGE_SYMBOL=package.json:
SPACESHIP_DOCKER_SYMBOL=docker-
SPACESHIP_PHP_SYMBOL=php-
SPACESHIP_VENV_PREFIX=venv:\
SPACESHIP_VENV_SYMBOL=venv-
SPACESHIP_VENV_COLOR=7
SPACESHIP_EXIT_CODE_SHOW=true
SPACESHIP_EXIT_CODE_SYMBOL=
SPACESHIP_EXIT_CODE_COLOR=9
SPACESHIP_VI_MODE_SHOW=false
SPACESHIP_VI_MODE_COLOR=2
SPACESHIP_VI_MODE_INSERT=\>\ \>
SPACESHIP_VI_MODE_NORMAL=\-\-\-
SPACESHIP_TIME_COLOR=7
SPACESHIP_EXEC_TIME_ELAPSED=1
SPACESHIP_EXEC_TIME_COLOR=8
SPACESHIP_DIR_TRUNC_PREFIX=.../
SPACESHIP_DIR_TRUNC=0
SPACESHIP_DIR_TRUNC_REPO=false
SPACESHIP_DIR_COLOR=13
SPACESHIP_GIT_BRANCH_COLOR=12
SPACESHIP_GIT_BRANCH_SUFFIX=
SPACESHIP_GIT_STATUS_PREFIX=\
SPACESHIP_GIT_STATUS_SUFFIX=\
SPACESHIP_GIT_STATUS_COLOR=6
SPACESHIP_GIT_STATUS_COLOR=red
SPACESHIP_GIT_STATUS_UNTRACKED=??
SPACESHIP_GIT_STATUS_ADDED=A
SPACESHIP_GIT_STATUS_MODIFIED=M
SPACESHIP_GIT_STATUS_RENAMED=R
SPACESHIP_GIT_STATUS_DELETED=D
SPACESHIP_GIT_STATUS_STASHED=S
SPACESHIP_GIT_STATUS_UNMERGED=U
SPACESHIP_GIT_STATUS_AHEAD=++
SPACESHIP_GIT_STATUS_BEHIND=--
SPACESHIP_GIT_STATUS_DIVERGED=v
SPACESHIP_PROMPT_PREFIXES_SHOW=false
SPACESHIP_PROMPT_SUFIXES_SHOW=false
SPACESHIP_DIR_TRUNC=0
SPACESHIP_DIR_COLOR=7
SPACESHIP_DIR_LOCK_COLOR=1
SPACESHIP_CHAR_SYMBOL=\>\
SPACESHIP_CHAR_COLOR_SUCCESS=2
SPACESHIP_CHAR_COLOR_FAILURE=1
SPACESHIP_JOBS_COLOR=13
SPACESHIP_JOBS_SYMBOL=\<\<\<
SPACESHIP_JOBS_AMOUNT_PREFIX=\
SPACESHIP_JOBS_AMOUNT_SUFFIX=\
SPACESHIP_JOBS_AAMOUNT_THRESHOLD=1
SPACESHIP_RPROMPT_ORDER=(
time # Time stamps section
exit_code # Exit code section
)
SPACESHIP_PROMPT_ORDER=(
user # Username section
host # Hostname section
git # Git section (git_branch + git_status)
docker # Docker section
venv # virtualenv section
pyenv # Pyenv section
dir # Current directory section
exec_time # Execution time
# battery # Battery level and status
line_sep # Line break
jobs # Background jobs indicator
vi_mode # Vi-mode indicator
exit_code # Exit code section
char # Prompt character
)
spaceship_vi_mode_disable
alias todone='task_done'
2020-05-11 13:36:07 +00:00
# remove duplicate PATH entries
# https://til.hashrocket.com/posts/7evpdebn7g-remove-duplicates-in-zsh-path
typeset -aU path