From d13aeacabe7f391f313a7eaab54c095d59fa1c81 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 22 May 2026 14:24:04 +0200 Subject: [PATCH] Fix the launcher to do inline replacement so it can be used as $EDITOR properly --- bin/omarchy-launch-editor | 25 ++++++++++++++++++------- config/uwsm/default | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/bin/omarchy-launch-editor b/bin/omarchy-launch-editor index 763055f0..8a69dabd 100755 --- a/bin/omarchy-launch-editor +++ b/bin/omarchy-launch-editor @@ -1,21 +1,32 @@ #!/bin/bash # omarchy:summary=Launch the default editor selected via Omarchy defaults. -# omarchy:args= +# omarchy:args=[--inline] -editor_file="$HOME/.local/state/omarchy/defaults/editor" -editor="nvim" +default_editor="$HOME/.local/state/omarchy/defaults/editor" -if [[ -f $editor_file ]]; then - read -r editor <"$editor_file" +if [[ ${1:-} == "--inline" ]]; then + inline=true + shift +else + inline=false +fi + +if [[ -f $default_editor ]]; then + read -r editor <"$default_editor" +else + editor="nvim" fi -[[ -n $editor ]] || editor="nvim" omarchy-cmd-present "$editor" || editor="nvim" case "${editor##*/}" in nvim | vim | nano | micro | hx | helix | fresh) - exec omarchy-launch-tui "$editor" "$@" + if [[ $inline == "true" ]]; then + exec "$editor" "$@" + else + exec omarchy-launch-tui "$editor" "$@" + fi ;; *) exec setsid uwsm-app -- "$editor" "$@" diff --git a/config/uwsm/default b/config/uwsm/default index 3b48ff37..107bf9f2 100644 --- a/config/uwsm/default +++ b/config/uwsm/default @@ -7,7 +7,7 @@ export TERMINAL=xdg-terminal-exec export BROWSER=omarchy-launch-browser # Used by terminal programs to open files with the selected Omarchy default editor -export EDITOR=omarchy-launch-editor +export EDITOR="omarchy-launch-editor --inline" # Use a custom directory for screenshots (remember to make the directory!) # export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots"