diff --git a/config/bash/editor b/config/bash/editor new file mode 100644 index 0000000..8e2fb2f --- /dev/null +++ b/config/bash/editor @@ -0,0 +1,26 @@ +#!/bin/bash +. ./lib + +options=() +options+=("nano" "") +options+=("vim" "") +options+=("vi" "") +options+=("edit" "") +options+=("unset" "") + +editor=$(whiptail --backtitle "$apptitle" --title "Default global editor :" --menu "" --cancel-button "Back" 0 0 0 \ + "${options[@]}" \ + 3>&1 1>&2 2>&3) +if [ ! "$?" = "0" ]; then + exit 1 +fi + +if [ "$editor" = "unset" ]; then + rm /etc/profile.d/editor.sh +else + echo "export EDITOR=$editor" > /etc/profile.d/editor.sh + chmod 755 /etc/profile.d/editor.sh +fi + +exit 0 + diff --git a/config/bash/menu b/config/bash/menu index fdf2f86..a9deb67 100644 --- a/config/bash/menu +++ b/config/bash/menu @@ -2,6 +2,7 @@ . ./lib options=() +options+=("/etc/profile.d/editor.sh" "") options+=("/etc/profile.d/alias.sh" "") options+=("/etc/profile.d/ps1.sh" "") options+=("Update .bashrc" "") @@ -16,6 +17,7 @@ fi sed -i "/^defaultitem=/c\defaultitem=\"$sel\"" $0 case $sel in + '/etc/profile.d/editor.sh') script config/bash/editor;; '/etc/profile.d/alias.sh') script config/bash/aliases;; '/etc/profile.d/ps1.sh') script config/bash/ps1;; 'Update .bashrc') script config/bash/bashrc;;