@@ -62,6 +62,7 @@ print_info() {
62
62
info "Uptime" uptime
63
63
info "Packages" packages
64
64
info "Shell" shell
65
+ info "Editor" editor
65
66
info "Resolution" resolution
66
67
info "DE" de
67
68
info "WM" wm
@@ -224,6 +225,32 @@ shell_path="off"
224
225
shell_version="on"
225
226
226
227
228
+ # Editor
229
+
230
+
231
+ # Show path to $EDITOR
232
+ #
233
+ # Default: 'off'
234
+ # Values: 'on', 'off'
235
+ # Flag: --editor_path
236
+ #
237
+ # Example:
238
+ # on: '/opt/bin/vim'
239
+ # off: 'vim'
240
+ editor_path="off"
241
+
242
+ # Show $EDITOR version
243
+ #
244
+ # Default: 'on'
245
+ # Values: 'on', 'off'
246
+ # Flag: '--editor_version'
247
+ #
248
+ # Example:
249
+ # on: 'vim 9.0'
250
+ # off: 'vim'
251
+ editor_version="on"
252
+
253
+
227
254
# CPU
228
255
229
256
@@ -1768,6 +1795,33 @@ get_shell() {
1768
1795
shell=${shell/ \( * \) }
1769
1796
}
1770
1797
1798
+ get_editor () {
1799
+ local editor_full_path=" ${VISUAL:- $EDITOR } "
1800
+
1801
+ case $editor_path in
1802
+ on) editor=" ${editor_full_path} " ;;
1803
+ off) editor=" ${editor_full_path##*/ } " ;;
1804
+ esac
1805
+
1806
+ [[ $editor_version != on ]] && return
1807
+
1808
+ case ${editor_name:= ${editor_full_path##*/ } } in
1809
+ nano|vim)
1810
+ editor+=$( " $editor_full_path " --version 2>&1 )
1811
+ editor=" ${editor/ $' \n ' * } "
1812
+ editor=" ${editor/ $editor_name } "
1813
+ ;;
1814
+ * )
1815
+ editor+=$( " $editor_full_path " --version 2>&1 )
1816
+ editor=" ${editor/ $' \n ' * } "
1817
+ ;;
1818
+ esac
1819
+
1820
+ editor=${editor/ , version}
1821
+ editor=${editor/ options* }
1822
+ editor=${editor/ \( * \) }
1823
+ }
1824
+
1771
1825
get_de () {
1772
1826
# If function was run, stop here.
1773
1827
(( de_run == 1 )) && return
@@ -5047,6 +5101,8 @@ INFO:
5047
5101
--gtk3 on/off Enable/Disable gtk3 theme/font/icons output
5048
5102
--shell_path on/off Enable/Disable showing \$ SHELL path
5049
5103
--shell_version on/off Enable/Disable showing \$ SHELL version
5104
+ --editor_path on/off Enable/Disable showing \$ EDITOR path
5105
+ --editor_version on/off Enable/Disable showing \$ EDITOR version
5050
5106
--disk_show value Which disks to display.
5051
5107
Possible values: '/', '/dev/sdXX', '/path/to/mount point'
5052
5108
@@ -5263,6 +5319,8 @@ get_args() {
5263
5319
" --gtk3" ) gtk3=" $2 " ;;
5264
5320
" --shell_path" ) shell_path=" $2 " ;;
5265
5321
" --shell_version" ) shell_version=" $2 " ;;
5322
+ " --editor_path" ) editor_path=" $2 " ;;
5323
+ " --editor_version" ) editor_version=" $2 " ;;
5266
5324
" --ip_host" ) public_ip_host=" $2 " ;;
5267
5325
" --ip_timeout" ) public_ip_timeout=" $2 " ;;
5268
5326
" --ip_interface" )
0 commit comments