[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
|
||||
[[ $editor_version != on ]] && return
|
||||
|
||||
# Obtain editor version
|
||||
case ${editor_name:=${editor_full_path##*/}} in
|
||||
nano|vim)
|
||||
editor+=$("$editor_full_path" --version 2>&1)
|
||||
editor="${editor/$'\n'*}"
|
||||
editor="${editor/$editor_name }"
|
||||
;;
|
||||
*)
|
||||
# editor+=$("$editor_full_path" --version 2>&1)
|
||||
editor="${editor/$'\n'*}"
|
||||
nano|vim|micro)
|
||||
editor_v=$("$editor_full_path" --version 2>&1)
|
||||
;;
|
||||
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
|
||||
editor=${editor/, version}
|
||||
|
|
Loading…
Reference in a new issue