From 59c323b383f0637267e79634cb8e3e02ffa85b09 Mon Sep 17 00:00:00 2001
From: Tobias Reisinger <tobias@msrg.cc>
Date: Tue, 13 Sep 2022 22:19:08 +0200
Subject: [PATCH] Add remote sourcing

---
 .bin/source-remote-file | 11 +++++++++++
 .config/zsh/.zshrc      |  7 ++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100755 .bin/source-remote-file

diff --git a/.bin/source-remote-file b/.bin/source-remote-file
new file mode 100755
index 0000000..fa82730
--- /dev/null
+++ b/.bin/source-remote-file
@@ -0,0 +1,11 @@
+base_path="$HOME/.cache/remote-sources"
+mkdir -p "$base_path"
+file_path="$base_path/$1"
+if [ ! -f "$file_path" ]
+then
+	echo "Installing file $1"
+	curl -Ls -o "$file_path" "$2"
+fi
+source $file_path
+
+# vim: ft=bash
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc
index 4e74b5b..2756744 100644
--- a/.config/zsh/.zshrc
+++ b/.config/zsh/.zshrc
@@ -77,7 +77,6 @@ function omz_install_custom_plugin() {
 		git clone "$2" "$plugin_path" >/dev/null 2>&1
 	fi
 }
-
 omz_install_custom_plugin "zsh-syntax-highlighting" "https://github.com/zsh-users/zsh-syntax-highlighting.git"
 
 
@@ -105,13 +104,13 @@ plugins=(
 	'zsh-syntax-highlighting'
 )
 
-source $ZSH/oh-my-zsh.sh
+source "$ZSH/oh-my-zsh.sh"
 
 # User configuration
 
 source "$HOME/.config/environment"
 source "$HOME/.config/completionsrc"
-[ -f "$HOME/.config/aliasrc" ] && source $HOME/.config/aliasrc
+source "$HOME/.config/aliasrc"
 [ -x "$(command -v thefuck)" ] && eval $(thefuck --alias)
 
 export MARKPATH="$HOME/.config/zsh/jump_marks"
@@ -121,4 +120,6 @@ export SAVEHIST=1000000
 export HISTSIZE=1000000
 export HISTFILE="$HOME/.cache/zsh_history"
 
+source source-remote-file "dracula-syntax-highlighting" "https://raw.githubusercontent.com/dracula/zsh-syntax-highlighting/master/zsh-syntax-highlighting.sh"
+
 [ -x "$(command -v starship)" ] && eval "$(starship init zsh)"