Add default editor selection
This commit is contained in:
parent
9b5f033f01
commit
07217622b1
2 changed files with 28 additions and 0 deletions
26
config/bash/editor
Normal file
26
config/bash/editor
Normal file
|
@ -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
|
||||
|
|
@ -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;;
|
||||
|
|
Loading…
Reference in a new issue