diff options
Diffstat (limited to 'terminal/dot-zshrc')
| -rw-r--r-- | terminal/dot-zshrc | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/terminal/dot-zshrc b/terminal/dot-zshrc new file mode 100644 index 0000000..3258454 --- /dev/null +++ b/terminal/dot-zshrc @@ -0,0 +1,142 @@ +export LANG=en_US.UTF-8 +export EDITOR=nvim + +# Set editor default keymap to emacs (`-e`) or vi (`-v`) +bindkey -e + +export HISTFILE=~/.zsh_history +export HISTSIZE=268435456 +export SAVEHIST="$HISTSIZE" + +setopt APPEND_HISTORY +setopt SHARE_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_FIND_NO_DUPS +setopt HIST_SAVE_NO_DUPS +setopt HIST_VERIFY +setopt HIST_IGNORE_SPACE +setopt HIST_REDUCE_BLANKS +setopt NO_NOMATCH + +# Remove path separator from WORDCHARS. +WORDCHARS=${WORDCHARS//[\/]} + +# ----------------- +# Zim configuration +# ----------------- + +setopt nopromptbang prompt{cr,percent,sp,subst} + +zstyle ':zim:git-info' verbose yes +zstyle ':zim:git-info:branch' format '%b' +zstyle ':zim:git-info:commit' format '%c' +zstyle ':zim:git-info:stashed' format '%F{#40995A}%S%f' +zstyle ':zim:git-info:dirty' format '%F{red}⚡%f' +zstyle ':zim:git-info:clean' format '%F{green}✓%f' +zstyle ':zim:git-info:indexed' format '%F{#F88C15}✚%f' +zstyle ':zim:git-info:untracked' format '%F{red}✹%f' +zstyle ':zim:git-info:keys' format 'prompt' ' %b%c %D%S%C%i%u ' + +zstyle ':zim:prompt-pwd' git-root no +zstyle ':zim:prompt-pwd:tail' length 2 + +autoload -Uz add-zsh-hook && add-zsh-hook precmd git-info + +# PS1='%K{#5F87AF}%F{yellow} $(prompt-pwd) %f%k%F{blue}%K{yellow}${(e)git_info[prompt]}%k%f %B%(?:%F{green}:%F{red})%{%G➤%}%b ' +PS1='%F{#F88C15}@${(%):-%m} %F{yellow} $(prompt-pwd) %f%F{#AACCFF}${(e)git_info[prompt]}%f %B%(?:%F{green}:%F{red})%{%G➤%}%b ' + +# termtitle + +# Set a custom terminal title format using prompt expansion escape sequences. +# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes +# If none is provided, the default '%n@%m: %~' is used. +# zstyle ':zim:termtitle' format '%1~' + +# zsh-autosuggestions + +# Disable automatic widget re-binding on each precmd. This can be set when +# zsh-users/zsh-autosuggestions is the last module in your ~/.zimrc. +ZSH_AUTOSUGGEST_MANUAL_REBIND=1 + +# Customize the style that the suggestions are shown with. +# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style +# ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=242' + +# zsh-syntax-highlighting + +# Set what highlighters will be used. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) + +# Customize the main highlighter styles. +# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it +# typeset -A ZSH_HIGHLIGHT_STYLES +# ZSH_HIGHLIGHT_STYLES[comment]='fg=242' + +# ------------------ +# Initialize modules +# ------------------ + +ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim +# Download zimfw plugin manager if missing. +if [[ ! -e ${ZIM_HOME}/zimfw.zsh ]]; then + if (( ${+commands[curl]} )); then + curl -fsSL --create-dirs -o ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + else + mkdir -p ${ZIM_HOME} && wget -nv -O ${ZIM_HOME}/zimfw.zsh \ + https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh + fi +fi +# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. +if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then + source ${ZIM_HOME}/zimfw.zsh init -q +fi +# Initialize modules. +source ${ZIM_HOME}/init.zsh + +# ------------------------------ +# Post-init module configuration +# ------------------------------ + +# zsh-history-substring-search + +zmodload -F zsh/terminfo +p:terminfo +# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init +for key ('^[[A' '^P' ${terminfo[kcuu1]}) bindkey ${key} history-substring-search-up +for key ('^[[B' '^N' ${terminfo[kcud1]}) bindkey ${key} history-substring-search-down +for key ('k') bindkey -M vicmd ${key} history-substring-search-up +for key ('j') bindkey -M vicmd ${key} history-substring-search-down +unset key + +# ------------------------------ +# My Stuff +alias grep='grep --color=auto' +alias ip='ip -color=auto' +alias xproxy='ssh -N -D 9090 illyria' +alias gk='gitk --all &' +alias ls='exa --icons' +alias tree='exa --icons --tree' +alias undercurl='echo -e "\e[4:3mUNDERCURL!"' + +alias mpd-start='systemctl start --user mpd' + +alias nocontrol="rm ~/.ssh/control:*" +alias mute_notifications="dunstify 'Muting notifications' && sleep 2 && dunstctl set-paused true" +alias unmute_notifications="dunstctl close-all && dunstctl set-paused false && dunstify 'Notifications unmutted'" + +eval "$(zoxide init zsh --cmd cd)" + +# Add RVM to PATH for scripting. Make sure this is the last PATH variable change. +# Source: https://github.com/rvm/rvm/issues/3212#issuecomment-274912875 +# Squelch the warning by appending ' > /dev/null 2>&1' here +[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" > /dev/null 2>&1 + +# RVM fixes whatever it considers the problem to be, on its own, in `rvm use`. +# It also prints some junk we don't care about, so we squelch its output in the same way. +rvm use default > /dev/null 2>&1 + +export ZK_NOTEBOOK_DIR="$HOME/Documents/zk" +fpath+=${ZDOTDIR:-~}/.zsh_functions |
