Fix the launcher to do inline replacement so it can be used as $EDITOR properly
This commit is contained in:
@@ -1,21 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# omarchy:summary=Launch the default editor selected via Omarchy defaults.
|
# omarchy:summary=Launch the default editor selected via Omarchy defaults.
|
||||||
# omarchy:args=<path>
|
# omarchy:args=[--inline] <path>
|
||||||
|
|
||||||
editor_file="$HOME/.local/state/omarchy/defaults/editor"
|
default_editor="$HOME/.local/state/omarchy/defaults/editor"
|
||||||
editor="nvim"
|
|
||||||
|
|
||||||
if [[ -f $editor_file ]]; then
|
if [[ ${1:-} == "--inline" ]]; then
|
||||||
read -r editor <"$editor_file"
|
inline=true
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
inline=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $default_editor ]]; then
|
||||||
|
read -r editor <"$default_editor"
|
||||||
|
else
|
||||||
|
editor="nvim"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -n $editor ]] || editor="nvim"
|
|
||||||
omarchy-cmd-present "$editor" || editor="nvim"
|
omarchy-cmd-present "$editor" || editor="nvim"
|
||||||
|
|
||||||
case "${editor##*/}" in
|
case "${editor##*/}" in
|
||||||
nvim | vim | nano | micro | hx | helix | fresh)
|
nvim | vim | nano | micro | hx | helix | fresh)
|
||||||
|
if [[ $inline == "true" ]]; then
|
||||||
|
exec "$editor" "$@"
|
||||||
|
else
|
||||||
exec omarchy-launch-tui "$editor" "$@"
|
exec omarchy-launch-tui "$editor" "$@"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exec setsid uwsm-app -- "$editor" "$@"
|
exec setsid uwsm-app -- "$editor" "$@"
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ export TERMINAL=xdg-terminal-exec
|
|||||||
export BROWSER=omarchy-launch-browser
|
export BROWSER=omarchy-launch-browser
|
||||||
|
|
||||||
# Used by terminal programs to open files with the selected Omarchy default editor
|
# 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!)
|
# Use a custom directory for screenshots (remember to make the directory!)
|
||||||
# export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots"
|
# export OMARCHY_SCREENSHOT_DIR="$HOME/Pictures/Screenshots"
|
||||||
|
|||||||
Reference in New Issue
Block a user