@@ -62,6 +62,7 @@ print_info() {
6262 info "Uptime" uptime
6363 info "Packages" packages
6464 info "Shell" shell
65+ info "Editor" editor
6566 info "Resolution" resolution
6667 info "DE" de
6768 info "WM" wm
@@ -237,6 +238,32 @@ shell_path="off"
237238shell_version="on"
238239
239240
241+ # Editor
242+
243+
244+ # Show path to $EDITOR
245+ #
246+ # Default: 'off'
247+ # Values: 'on', 'off'
248+ # Flag: --editor_path
249+ #
250+ # Example:
251+ # on: '/opt/bin/vim'
252+ # off: 'vim'
253+ editor_path="off"
254+
255+ # Show $EDITOR version
256+ #
257+ # Default: 'on'
258+ # Values: 'on', 'off'
259+ # Flag: '--editor_version'
260+ #
261+ # Example:
262+ # on: 'vim 9.0'
263+ # off: 'vim'
264+ editor_version="on"
265+
266+
240267# CPU
241268
242269
@@ -2065,6 +2092,38 @@ get_shell() {
20652092 shell=${shell/ \( * \) }
20662093}
20672094
2095+ get_editor () {
2096+ local editor_full_path=" ${VISUAL:- $EDITOR } "
2097+
2098+ # in case neither is set just return
2099+ [[ -z " $editor_full_path " ]] && return
2100+
2101+ case $editor_path in
2102+ on) editor=" ${editor_full_path} " ;;
2103+ off) editor=" ${editor_full_path##*/ } " ;;
2104+ esac
2105+
2106+ # in case editor version is not demanded don't bother parsing it
2107+ [[ $editor_version != on ]] && return
2108+
2109+ case ${editor_name:= ${editor_full_path##*/ } } in
2110+ nano|vim)
2111+ editor+=$( " $editor_full_path " --version 2>&1 )
2112+ editor=" ${editor/ $' \n ' * } "
2113+ editor=" ${editor/ $editor_name } "
2114+ ;;
2115+ * )
2116+ editor+=$( " $editor_full_path " --version 2>&1 )
2117+ editor=" ${editor/ $' \n ' * } "
2118+ ;;
2119+ esac
2120+
2121+ # remove some common unwanted info from version strings
2122+ editor=${editor/ , version}
2123+ editor=${editor/ options* }
2124+ editor=${editor/ \( * \) }
2125+ }
2126+
20682127get_de () {
20692128 # If function was run, stop here.
20702129 (( de_run == 1 )) && return
@@ -5822,6 +5881,8 @@ INFO:
58225881 --gtk3 on/off Enable/Disable gtk3 theme/font/icons output
58235882 --shell_path on/off Enable/Disable showing \$ SHELL path
58245883 --shell_version on/off Enable/Disable showing \$ SHELL version
5884+ --editor_path on/off Enable/Disable showing \$ EDITOR path
5885+ --editor_version on/off Enable/Disable showing \$ EDITOR version
58255886 --disk_show value Which disks to display.
58265887 Possible values: '/', '/dev/sdXX', '/path/to/mount point'
58275888
@@ -6049,6 +6110,8 @@ get_args() {
60496110 " --qt" ) qt=" $2 " ;;
60506111 " --shell_path" ) shell_path=" $2 " ;;
60516112 " --shell_version" ) shell_version=" $2 " ;;
6113+ " --editor_path" ) editor_path=" $2 " ;;
6114+ " --editor_version" ) editor_version=" $2 " ;;
60526115 " --ip_host" ) public_ip_host=" $2 " ;;
60536116 " --ip_timeout" ) public_ip_timeout=" $2 " ;;
60546117 " --ip_interface" )
0 commit comments