From 17efd5e4933ccd4c9604bd4ff51e7fc6d0070a11 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 11 Jul 2026 11:42:55 -0700 Subject: [PATCH] Ensure EDITOR is exported for non-uwsm envs too Like SSH'ing into an Omarchy machine --- default/bash/envs | 1 + test/shell.d/editor-env-test.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/shell.d/editor-env-test.sh diff --git a/default/bash/envs b/default/bash/envs index ba36cb33..d526a692 100644 --- a/default/bash/envs +++ b/default/bash/envs @@ -1,4 +1,5 @@ # Editor used by CLI +export EDITOR="${EDITOR:-omarchy-launch-editor --inline}" export SUDO_EDITOR="$EDITOR" export BAT_THEME=ansi diff --git a/test/shell.d/editor-env-test.sh b/test/shell.d/editor-env-test.sh new file mode 100644 index 00000000..4aeabcf8 --- /dev/null +++ b/test/shell.d/editor-env-test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -euo pipefail + +source "$(dirname "$0")/base-test.sh" + +envs="$ROOT/default/bash/envs" + +editor=$(env -u EDITOR bash -c 'source "$1"; printf "%s" "$EDITOR"' bash "$envs") +[[ $editor == "omarchy-launch-editor --inline" ]] || fail "bash env provides a default editor" "actual: $editor" +pass "bash env provides a default editor" + +editor=$(EDITOR=helix bash -c 'source "$1"; printf "%s" "$EDITOR"' bash "$envs") +[[ $editor == "helix" ]] || fail "bash env preserves the inherited editor" "actual: $editor" +pass "bash env preserves the inherited editor" + +sudo_editor=$(env -u EDITOR -u SUDO_EDITOR bash -c 'source "$1"; printf "%s" "$SUDO_EDITOR"' bash "$envs") +[[ $sudo_editor == "omarchy-launch-editor --inline" ]] || fail "sudo uses the default editor" "actual: $sudo_editor" +pass "sudo uses the default editor"