diff --git a/.aliases.d/0-define-editors.sh b/.aliases.d/0-define-editors.sh index 9d5a66a..eb08cb1 100644 --- a/.aliases.d/0-define-editors.sh +++ b/.aliases.d/0-define-editors.sh @@ -1,2 +1,21 @@ -# clear out the screen -clear +# 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' diff --git a/scripts/helper/scan_aliases.sh b/scripts/helper/scan_aliases.sh index e00d3a3..8885190 100755 --- a/scripts/helper/scan_aliases.sh +++ b/scripts/helper/scan_aliases.sh @@ -95,7 +95,7 @@ prompter_for_fix() { good=1 if [ ! -f "$SANE_CHECKER" ]; then echo -e "\033[0;34m 1st run added to sane sum file! \033[0m" - $SHA_SUM_APP {~/scripts/*.sh,~/.aliases.d/*.sh,~/.bash_aliases,~/.bashrc,~/.bash_logout,~/scripts/helper/.git_bash_prompt,~/.profile,~/scripts/helper/.kube-ps1,~/scripts/helper/theme} > "$tmpsum" 2>/dev/null + $SHA_SUM_APP {~/scripts/*.sh,~/scripts/helper/*.sh,~/.aliases.d/*.sh,~/.bash_aliases,~/.bashrc,~/.bash_logout,~/scripts/helper/.git_bash_prompt,~/.profile,~/scripts/helper/.kube-ps1,~/scripts/helper/theme} > "$tmpsum" 2>/dev/null require_root "$SANE_CHECKER" "$tmpsum" good=0 else @@ -123,6 +123,12 @@ check_certificates() { SANE_TEST_FAILED=1 fi done + for FILE in ~/scripts/helper/*.sh; do + if [ -f "$FILE" ] && ! grep -q "$FILE" "$SANE_CHECKER"; then + echo -e "\033[0;31m $FILE is a new file! \r\n Please Scan it for viruses. \033[0m" >> "$error_status" + SANE_TEST_FAILED=1 + fi + done for FILE in ~/.aliases.d/*.sh; do if [ -f "$FILE" ] && ! grep -q "$FILE" "$SANE_CHECKER"; then echo -e "\033[0;31m $FILE is a new file! \r\n Please Scan it for viruses. \033[0m" >> "$error_status"