From 8fbabd0d7a859ef0b8ea03d0b1565cfcb00a305e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 18 Dec 2024 23:29:15 +0200 Subject: Update content for gemtext --- gemfeed/atom.xml | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'gemfeed') diff --git a/gemfeed/atom.xml b/gemfeed/atom.xml index 99551e36..ea33e0a8 100644 --- a/gemfeed/atom.xml +++ b/gemfeed/atom.xml @@ -1,6 +1,6 @@ - 2024-12-15T18:50:02+02:00 + 2024-12-18T23:28:38+02:00 foo.zone feed To be in the .zone! @@ -20,7 +20,7 @@

Random Helix Themes



-Published at 2024-12-15T13:55:05+02:00
+Published at 2024-12-15T13:55:05+02:00; Last updated 2024-12-18

I thought it would be fun to have a random Helix theme every time I open a new shell. Helix is the text editor I use.

@@ -79,6 +79,43 @@ http://www.gnu.org/software/src-highlite --> [paul@earth] ~ %
+

A better version


+
+Update 2024-12-18: This is an improved version, which works cross platform (e.g., also on MacOS) and multiple theme directories:
+
+ +
export EDITOR=hx
+export VISUAL=$EDITOR
+export GIT_EDITOR=$EDITOR
+export HELIX_CONFIG_DIR=$HOME/.config/helix
+
+editor::helix::theme::get_random () {
+    for dir in $(hx --health \
+        | awk '/^Runtime directories/ { print $3 }' | tr ';' ' '); do
+        if [ -d $dir/themes ]; then
+            ls $dir/themes
+        fi
+    done | grep -F .toml | sort -R | head -n 1 | cut -d. -f1
+}
+
+editor::helix::theme::set () {
+    local -r theme="$1"; shift
+
+    local -r config_file=$HELIX_CONFIG_DIR/config.toml
+
+    sed "/^theme =/ { s/.*/theme = \"$theme\"/; }" \
+        $config_file > $config_file.tmp && 
+        mv $config_file.tmp $config_file
+}
+
+if [ -f $HELIX_CONFIG_DIR/config.toml ]; then
+    editor::helix::theme::set $(editor::helix::theme::get_random)
+fi
+
+
I hope you had some fun. E-Mail your comments to paul@nospam.buetow.org :-)

Back to the main site
-- cgit v1.2.3