################################################################################ # Basic configuration ################################################################################ setopt BEEP export TERM=alacritty export LANG=en_US.UTF-8 # Disable the log builtin, so we don't conflict with /usr/bin/log disable log # Correctly display UTF-8 with combining characters. if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then setopt COMBINING_CHARS fi ################################################################################ # History ################################################################################ HISTFILE=${ZDOTDIR}/.zsh_history HISTSIZE=2147483647 SAVEHIST=$HISTSIZE export HISTORY_IGNORE="(ls|lsd|la|cd|pwd|exit)*" setopt HIST_EXPIRE_DUPS_FIRST setopt HIST_IGNORE_ALL_DUPS setopt HIST_IGNORE_DUPS setopt HIST_IGNORE_SPACE setopt HIST_REDUCE_BLANKS setopt HIST_VERIFY setopt INC_APPEND_HISTORY setopt SHARE_HISTORY ################################################################################ # Prompt ################################################################################ # A pleasant, informative, and transient prompt. Made possible by an arcane # incantation from [powerlevel10k](https://github.com/romkatv/powerlevel10k/), # as described in the project's issue tracker: # https://github.com/romkatv/powerlevel10k/issues/888#issuecomment-657969840 autoload -Uz compinit compinit autoload -Uz vcs_info precmd_vcs_info() { vcs_info } setopt prompt_subst zstyle ':vcs_info:git:*' formats '%F{3}%F{8} %b ' set-long-prompt() { if [ "$NEW_LINE_BEFORE_PROMPT" -eq 1 ]; then print '' else NEW_LINE_BEFORE_PROMPT=1 fi PROMPT='%F{3}%F{8} %d %0(?..%F{3}%F{8} %? )${vcs_info_msg_0_}%F{3}󰒋%F{8} %m %F{3}%F{8} %n %F{3}$ %f%k' } set-short-prompt() { if [[ $PROMPT != '%F{3}$ %f%k' ]]; then PROMPT='%F{3}$ %f%k' zle .reset-prompt fi } precmd_functions=( set-long-prompt precmd_vcs_info ) zle-line-finish() { set-short-prompt } zle -N zle-line-finish trap 'set-short-prompt; return 130' INT ################################################################################ # Potentially interactive execution ################################################################################ # Load SSH key into keychain if [[ $OSTYPE == darwin* ]] then ssh-add --apple-use-keychain ~/.ssh/id_rsa >/dev/null 2>&1 else eval `keychain --eval --quiet id_rsa` fi ################################################################################ # Aliases ################################################################################ alias dockerprune="(docker system prune -a -f && docker system df -v) | less" ################################################################################ # fzf ################################################################################ if command -v fzf >> /dev/null; then eval "$(fzf --zsh)" fi ################################################################################ # From github.com/zsh-users: # * zsh-autosuggestions # * zsh-syntax-highlighting # Both can be installed through Homebrew. ################################################################################ if command -v brew >> /dev/null; then source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh fi