diff options
author | Matt Strapp <matt@mattstrapp.net> | 2023-11-06 11:18:18 -0600 |
---|---|---|
committer | Matt Strapp <matt@mattstrapp.net> | 2023-11-06 11:18:18 -0600 |
commit | d0e00cb8710be008a0b25f37ce254b5622bd051b (patch) | |
tree | 2268b90c59f4d7bf84e8a4e944540e093006f4c6 /dot_config/zsh/dot_zshrc | |
parent | WSL: add .exe fallback (diff) | |
download | dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar.gz dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar.bz2 dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar.lz dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar.xz dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.tar.zst dotfiles-d0e00cb8710be008a0b25f37ce254b5622bd051b.zip |
Migrate to chezmoi (https://chezmoi.io)
Diffstat (limited to 'dot_config/zsh/dot_zshrc')
-rw-r--r-- | dot_config/zsh/dot_zshrc | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc new file mode 100644 index 0000000..bdd34e1 --- /dev/null +++ b/dot_config/zsh/dot_zshrc @@ -0,0 +1,128 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +[[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] && source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +# add .local/bin to PATH +export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" +#export PATH="${$(find ~/.local/bin -type d -printf %p:)%%:}:$PATH" + +eval "$(antidot init)" +#eval "$(lesspipe.sh)" + +# Luke's config for the Zoomer Shell + +if [ -f /etc/os-release ] +then + . /etc/os-release +else + ID=`uname -s` +fi +case "$ID" in + Darwin ) + source $HOME/.nix-profile/share/zsh-powerlevel10k/powerlevel10k.zsh-theme + ;; + * ) + [ -f /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme ] && source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme || source ${XDG_DATA_HOME:-$HOME/.local/share}/powerlevel10k/powerlevel10k.zsh-theme + ;; +esac + + +# Enable colors and change prompt: +autoload -U colors && colors # Load colors +setopt autocd # Automatically cd into typed directory. +#stty stop undef # Disable ctrl-s to freeze terminal. +setopt interactive_comments +setopt complete_aliases + +# History in cache directory: +HISTSIZE=100000000 +SAVEHIST=100000000 +HISTFILE="$XDG_STATE_HOME"/zsh/history +setopt BANG_HIST # Treat the '!' character specially during expansion. +setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format. +setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits. +setopt SHARE_HISTORY # Share history between all sessions. +setopt HIST_EXPIRE_DUPS_FIRST # Expire duplicate entries first when trimming history. +setopt HIST_IGNORE_DUPS # Don't record an entry that was just recorded again. +setopt HIST_IGNORE_ALL_DUPS # Delete old recorded entry if new entry is a duplicate. +setopt HIST_FIND_NO_DUPS # Do not display a line previously found. +setopt HIST_IGNORE_SPACE # Don't record an entry starting with a space. +setopt HIST_SAVE_NO_DUPS # Don't write duplicate entries in the history file. +setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording entry. +setopt HIST_VERIFY # Don't execute immediately upon history expansion. +setopt HIST_BEEP # Beep when accessing nonexistent history. + +# Load aliases and shortcuts if existent. +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshopts" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zshopts" + +# Basic auto/tab complete: +fpath=(~/.config/zsh/completions $fpath) +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +#compinit +compinit -d ~/.cache/zsh/zcompdump-$ZSH_VERSION +_comp_options+=(globdots) # Include hidden files. + +# To customize prompt, run `p10k configure` or edit ~/.config/zsh/. p10k.zsh. +[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh +[[ ! -f ~/.config/zsh/keybindings.zsh ]] || source ~/.config/zsh/keybindings.zsh + +# zsh parameter completion for the dotnet CLI +_dotnet_zsh_complete() +{ + local completions=("$(dotnet complete "$words")") + + # If the completion list is empty, just continue with filename selection + if [ -z "$completions" ] + then + _arguments '*::arguments: _normal' + return + fi + + # This is not a variable assignment, don't remove spaces! + _values = "${(ps:\n:)completions}" +} + +compdef _dotnet_zsh_complete dotnet + +[[ -f ~/.config/tabtab/zsh/__tabtab.zsh ]] && . ~/.config/tabtab/zsh/__tabtab.zsh || true + +if [ -n $WSL_DISTRO_NAME ] +then + command_not_found_handler() { + if [ -x "$(command -v $@.exe)" ]; then + $@.exe + else + echo >&2 "zsh: command not found: $@" + return 127 + fi +} +fi + + +case "$ID" in + debian | ubuntu ) + source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh + source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + ;; + arch | artix | msys2 ) + source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh + source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + ;; + gentoo ) + source /usr/share/zsh/site-functions/zsh-syntax-highlighting.zsh + source /usr/share/zsh/site-functions/zsh-autosuggestions.zsh + ;; + Darwin ) + source $HOME/.nix-profile/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + source $HOME/.nix-profile/share/zsh-autosuggestions/zsh-autosuggestions.zsh + ;; + * ) + echo "no highlight for you" + ;; +esac + |