You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
dotfiles/.aliases.d/0-define-editors.sh

21 lines
667 B

# to change default editor change order here:
editors=("nano" "pico" "neovim" "vim" "vi" "emacs")
geditors=("geany" "brackets" "notepadqq" "code" "medit" "gnome-text-editor" "mousepad" "leafpad" "kwrite" "kate" "pluma" "xed" "sublime" "atom" "gvim")
for editor in "${editors[@]}"; do
full_path=$(command -v "$editor" 2> /dev/null)
if [ -n "$full_path" ]; then
export EDITOR="$full_path"
break
fi
done
for geditor in "${geditors[@]}"; do
full_path=$(command -v "$geditor" 2> /dev/null)
if [ -n "$full_path" ]; then
export VISUAL="$full_path"
break
fi
done
alias ,='$EDITOR'
vis() { $VISUAL $@ & }
alias @='vis'