Files
omarchy/bin/omarchy-launch-editor
T
2026-09-22 17:45:31 +02:00

38 lines
767 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Launch the default editor selected via Omarchy defaults.
# omarchy:args=[--inline] <path>
default_editor="$HOME/.local/state/omarchy/defaults/editor"
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
# sublime-text-4 ships `subl` on PATH, not `sublime_text`.
[[ $editor == sublime_text ]] && editor=subl
omarchy-cmd-present "$editor" || editor="nvim"
case "${editor##*/}" in
nvim | vim | nano | micro | hx | helix | fresh)
if [[ $inline == "true" ]]; then
exec "$editor" -- "$@"
else
exec omarchy-launch-tui "$editor" -- "$@"
fi
;;
*)
exec setsid uwsm-app -- "$editor" -- "$@"
;;
esac