|
@@ -0,0 +1,101 @@
|
|
|
|
|
+################################################################################
|
|
|
|
|
+# ZSH Configuration
|
|
|
|
|
+#
|
|
|
|
|
+# Note: in order for files in ~/.config/ to be picked up, be sure to set the
|
|
|
|
|
+# global XDG_* and ZDOTDIR paths. On macOS, these is set at /etc/zshenv, and
|
|
|
|
|
+# look something like the following block:
|
|
|
|
|
+#
|
|
|
|
|
+# export XDG_CONFIG_HOME=$HOME/.config
|
|
|
|
|
+# export XDG_CACHE_HOME=$HOME/.cache
|
|
|
|
|
+# export XDG_DATA_HOME=$HOME/.local/share
|
|
|
|
|
+# export XDG_STATE_HOME=$HOME/.local/state
|
|
|
|
|
+# export XDG_RUNTIME_DIR=$HOME/.run
|
|
|
|
|
+# export XDG_DATA_DIRS=/usr/local/share:/usr/share
|
|
|
|
|
+# export XDG_CONFIG_DIRS=/etc/xdg
|
|
|
|
|
+# export ZDOTDIR=$XDG_CONFIG_HOME/zsh
|
|
|
|
|
+#
|
|
|
|
|
+################################################################################
|
|
|
|
|
+
|
|
|
|
|
+################################################################################
|
|
|
|
|
+# Basic configuration
|
|
|
|
|
+################################################################################
|
|
|
|
|
+
|
|
|
|
|
+export TERM=alacritty
|
|
|
|
|
+export LANG=en_US.UTF-8
|
|
|
|
|
+
|
|
|
|
|
+export HISTSIZE=50000
|
|
|
|
|
+export SAVEHIST=50000
|
|
|
|
|
+export HISTORY_IGNORE="(ls|lsd|la|cd|pwd|exit)*"
|
|
|
|
|
+setopt INC_APPEND_HISTORY
|
|
|
|
|
+setopt HIST_IGNORE_ALL_DUPS
|
|
|
|
|
+setopt HIST_IGNORE_SPACE
|
|
|
|
|
+setopt HIST_REDUCE_BLANKS
|
|
|
|
|
+
|
|
|
|
|
+################################################################################
|
|
|
|
|
+# 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 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
|
|
|
|
|
+
|
|
|
|
|
+################################################################################
|
|
|
|
|
+# 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
|