1 # AX-ZSH: Alex' Modular ZSH Configuration
2 # editor_select.zprofile: Setup $EDITOR for the "best" available editor
4 if [[ -n "$EDITOR" && ! -x "$EDITOR" && -z "$commands[$EDITOR]" ]]; then
5 # Oops, current $EDITOR seems to be invalid! Start over!
9 if [[ -z "$EDITOR" ]]; then
10 # Check user preferences first!
11 if [[ -r ~/.selected_editor ]]; then
13 if [[ -x "$SELECTED_EDITOR" || -n "$commands[$SELECTED_EDITOR]" ]]; then
14 EDITOR="$SELECTED_EDITOR"
20 if [[ -z "$EDITOR" ]]; then
21 # Auto-detect a "good" editor ...
22 if [[ -n "$DISPLAY" ]]; then
23 # X11 available, consider X11-based editors, too!
29 code atom mate subl mvim
33 if [[ -n "$commands[$editor]" ]]; then
34 EDITOR="$commands[$editor]"
38 unset editor x11_editors
42 "code"|"atom"|"mate"|"subl")
43 EDITOR="$EDITOR --wait"
46 EDITOR="$EDITOR --nofork"
50 [[ -n "$EDITOR" ]] && export EDITOR