Ensure EDITOR is exported for non-uwsm envs too

Like SSH'ing into an Omarchy machine
This commit is contained in:
David Heinemeier Hansson
2026-07-11 11:42:55 -07:00
parent cc64c3e27c
commit 17efd5e493
2 changed files with 20 additions and 0 deletions
+1
View File
@@ -1,4 +1,5 @@
# Editor used by CLI
export EDITOR="${EDITOR:-omarchy-launch-editor --inline}"
export SUDO_EDITOR="$EDITOR"
export BAT_THEME=ansi
+19
View File
@@ -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"