]> arthur.ath.cx Git - OhMyZshExtensions.git/blob - plugins/editor_select/editor_select.plugin.zsh
"editor_select": Simplify script
[OhMyZshExtensions.git] / plugins / editor_select / editor_select.plugin.zsh
1 # editor-select.plugin.zsh
2
3 for editor in atom mate subl vim vi; do
4         if [ -n "$commands[$editor]" ]; then
5                 EDITOR="$commands[$editor]"
6                 break
7         fi
8 done
9 unset editor
10
11 case "$(basename "$EDITOR")" in
12         "atom"|"mate"|"subl")
13                 EDITOR="$EDITOR --wait"
14                 ;;
15 esac
16
17 if [ -n "$EDITOR" ]; then
18         export EDITOR
19         alias zshrc="$EDITOR ~/.zshrc"
20 fi