From 0453f24c59683baaacd9a79c7c35e725733d32be Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Wed, 20 Nov 2024 03:22:58 -0600 Subject: [PATCH] Make terminal work in vscode and beyond This has been a pain since this repo was created, but it turns out the bug is related to antigen application. If we apply everytime, we ensure oh-my-zsh is loaded correctly and themes work. While we're here, I also sourced the nvm plugin from oh-my-zsh, and removed and removed avn. --- zsh/nvm-hook | 22 ---------------------- zsh/themes/sparkle.zsh | 20 -------------------- zsh/themes/sparkle.zsh-theme | 26 ++++++++++++++++++++++++++ zshrc | 21 ++++++++------------- 4 files changed, 34 insertions(+), 55 deletions(-) delete mode 100644 zsh/nvm-hook delete mode 100644 zsh/themes/sparkle.zsh create mode 100644 zsh/themes/sparkle.zsh-theme diff --git a/zsh/nvm-hook b/zsh/nvm-hook deleted file mode 100644 index 3610e5a..0000000 --- a/zsh/nvm-hook +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/zsh - -autoload -U add-zsh-hook -function load-nvmrc() { - local node_version="$(nvm version)" - local nvmrc_path="$(nvm_find_nvmrc)" - - if [ -n "$nvmrc_path" ]; then - local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") - - if [ "$nvmrc_node_version" = "N/A" ]; then - nvm install - elif [ "$nvmrc_node_version" != "$node_version" ]; then - nvm use - fi - elif [ "$node_version" != "$(nvm version default)" ]; then - echo "Reverting to nvm default version" - nvm use default - fi -} -add-zsh-hook chpwd load-nvmrc -load-nvmrc \ No newline at end of file diff --git a/zsh/themes/sparkle.zsh b/zsh/themes/sparkle.zsh deleted file mode 100644 index 972ca5d..0000000 --- a/zsh/themes/sparkle.zsh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/zsh - -function ssh_connection() { - if [[ -n $SSH_CONNECTION ]]; then - echo "%{$fg_bold[magenta]%}(ssh) " - fi -} - -PROMPT='$(ssh_connection)' -PROMPT+='✨ ' -PROMPT+='%{${fg_bold[yellow]}%}%c ' -PROMPT+='$(git_prompt_info)' -PROMPT+='%{${fg_bold[grey]}%}[%?] ' -PROMPT+='%{${fg_bold[white]}%}%#' -PROMPT+='%{${reset_color}%} ' - -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[red]%}<" -ZSH_THEME_GIT_PROMPT_SUFFIX="> %{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY=":✘" -ZSH_THEME_GIT_PROMPT_CLEAN=":✔" diff --git a/zsh/themes/sparkle.zsh-theme b/zsh/themes/sparkle.zsh-theme new file mode 100644 index 0000000..4f20c3e --- /dev/null +++ b/zsh/themes/sparkle.zsh-theme @@ -0,0 +1,26 @@ +function ssh_connection() { + if [[ -n $SSH_CONNECTION ]]; then + return "${BOLD_MAGENTA}(ssh) " + fi +} + +BOLD_MAGENTA="%{%B%F{magenta}%}" +BOLD_YELLOW="%{%B%F{yellow}%}" +BOLD_GREY="%{%B%F{#566573}%}" +BOLD_WHITE="%{%B%F{white}%}" +BOLD_RED="%{%B%F{red}%}" +CLEAR="%{%f%k%b%}" + + +PROMPT='%{$(ssh_connection)%}' +PROMPT+="✨ " +PROMPT+="${BOLD_YELLOW}%c${CLEAR} " +PROMPT+='$(git_prompt_info)' +PROMPT+="${BOLD_GREY}[%?] " +PROMPT+="${BOLD_WHITE}# " +PROMPT+="${CLEAR}" + +ZSH_THEME_GIT_PROMPT_PREFIX="${BOLD_RED}<" +ZSH_THEME_GIT_PROMPT_SUFFIX="> ${CLEAR}" +ZSH_THEME_GIT_PROMPT_DIRTY=":✘" +ZSH_THEME_GIT_PROMPT_CLEAN=":✔" diff --git a/zshrc b/zshrc index 7460ecb..f33b019 100644 --- a/zshrc +++ b/zshrc @@ -2,20 +2,15 @@ source ~/.zsh/antigen/bin/antigen.zsh -if [[ $ANTIGEN_APPLIED != true ]]; then - antigen use oh-my-zsh - antigen bundle git - antigen bundle zsh-users/zsh-autosuggestions - antigen bundle zsh-users/zsh-syntax-highlighting - antigen apply -fi -export ANTIGEN_APPLIED=true - -source ~/.zsh/themes/sparkle.zsh +antigen use oh-my-zsh +antigen bundle git +antigen bundle nvm +antigen bundle zsh-users/zsh-completions +antigen bundle zsh-users/zsh-autosuggestions +antigen bundle zsh-users/zsh-syntax-highlighting +antigen apply +source ~/.zsh/themes/sparkle.zsh-theme source ~/.bashrc -source ~/.zsh/nvm-hook - [[ -f ~/.zshrc.local ]] && source ~/.zshrc.local -[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn