Files
arthur-os/bin/omarchy-default-editor
T
David Heinemeier HanssonandGitHub 95d8125e59 Set default terminal, browser, editor explicitly (#5651)
* Set default terminal, browser, editor explicitly

* Consistent glyphs and setup

* Tweaks

* Always there

* Proper order

* Don't make a browser the default just because it's getting installed
2026-05-07 16:11:48 +02:00

31 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# omarchy:summary=Set the default editor for $EDITOR
# omarchy:args=[code|cursor|zed|sublime_text|helix|vim|emacs|nvim]
# omarchy:examples=omarchy default editor | omarchy default editor code | omarchy default editor helix
if (($# == 0)); then
sed -n 's/^export EDITOR=//p' ~/.config/uwsm/default | head -n 1
exit 0
fi
case "$1" in
code) editor="code"; name="VSCode"; glyph="" ;;
cursor) editor="cursor"; name="Cursor"; glyph="" ;;
zed) editor="zed"; name="Zed"; glyph="" ;;
sublime_text) editor="sublime_text"; name="Sublime Text"; glyph="" ;;
helix) editor="helix"; name="Helix"; glyph="" ;;
vim) editor="vim"; name="Vim"; glyph="" ;;
emacs) editor="emacs"; name="Emacs"; glyph="" ;;
nvim) editor="nvim"; name="Neovim"; glyph="" ;;
*)
echo "Usage: omarchy-default-editor <code|cursor|zed|sublime_text|helix|vim|emacs|nvim>"
exit 1
;;
esac
sed -i "s/^export EDITOR=.*/export EDITOR=$editor/" ~/.config/uwsm/default
export EDITOR="$editor"
notify-send -u low "$glyph $name is now the default editor" " Effective after logging out"