[O] Optimize editor detection
This commit is contained in:
parent
14bde2e49b
commit
7491081946
1 changed files with 9 additions and 8 deletions
17
neofetch
17
neofetch
|
@ -2292,17 +2292,18 @@ get_editor() {
|
||||||
# in case editor version is not demanded don't bother parsing it
|
# in case editor version is not demanded don't bother parsing it
|
||||||
[[ $editor_version != on ]] && return
|
[[ $editor_version != on ]] && return
|
||||||
|
|
||||||
|
# Obtain editor version
|
||||||
case ${editor_name:=${editor_full_path##*/}} in
|
case ${editor_name:=${editor_full_path##*/}} in
|
||||||
nano|vim)
|
nano|vim|micro)
|
||||||
editor+=$("$editor_full_path" --version 2>&1)
|
editor_v=$("$editor_full_path" --version 2>&1)
|
||||||
editor="${editor/$'\n'*}"
|
|
||||||
editor="${editor/$editor_name }"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# editor+=$("$editor_full_path" --version 2>&1)
|
|
||||||
editor="${editor/$'\n'*}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
editor_v="${editor_v/$'\n'*}"
|
||||||
|
editor_v="${editor_v/Version: }"
|
||||||
|
|
||||||
|
# Only show editor name if the version string doesn't contain it
|
||||||
|
echo "$editor_v" | grep -i "$editor_name" &> /dev/null && editor_name=""
|
||||||
|
editor=${editor_name}${editor_v:+ }${editor_v}
|
||||||
|
|
||||||
# remove some common unwanted info from version strings
|
# remove some common unwanted info from version strings
|
||||||
editor=${editor/, version}
|
editor=${editor/, version}
|
||||||
|
|
Loading…
Reference in a new issue