Skip to content

Commit a3a4c1e

Browse files
committed
plugins/xterm: not just Xterm
1 parent d516478 commit a3a4c1e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

plugins/available/xterm.plugin.bash

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cite about-plugin
33
about-plugin 'automatically set your xterm title with host and location info'
44

5-
_short-dirname() {
5+
function _short-dirname() {
66
local dir_name="${PWD/~/\~}"
77
if [[ "${SHORT_TERM_LINE:-}" == true && "${#dir_name}" -gt 8 ]]; then
88
echo "${dir_name##*/}"
@@ -11,7 +11,7 @@ _short-dirname() {
1111
fi
1212
}
1313

14-
_short-command() {
14+
function _short-command() {
1515
local input_command="$*"
1616
if [[ "${SHORT_TERM_LINE:-}" == true && "${#input_command}" -gt 8 ]]; then
1717
echo "${input_command%% *}"
@@ -20,16 +20,16 @@ _short-command() {
2020
fi
2121
}
2222

23-
set_xterm_title() {
23+
function set_xterm_title() {
2424
local title="${1:-}"
2525
echo -ne "\033]0;${title}\007"
2626
}
2727

28-
precmd_xterm_title() {
28+
function precmd_xterm_title() {
2929
set_xterm_title "${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}} $(_short-dirname) ${PROMPT_CHAR:-\$}"
3030
}
3131

32-
preexec_xterm_title() {
32+
function preexec_xterm_title() {
3333
local command_line="${BASH_COMMAND:-${1:-}}"
3434
local directory_name short_command
3535
directory_name="$(_short-dirname)"
@@ -38,8 +38,8 @@ preexec_xterm_title() {
3838
}
3939

4040
case "${TERM:-dumb}" in
41-
xterm* | rxvt*)
42-
precmd_functions+=(precmd_xterm_title)
43-
preexec_functions+=(preexec_xterm_title)
41+
xterm* | rxvt* | gnome-terminal | konsole | zvt | dtterm | kterm | Eterm | zterm)
42+
safe_append_prompt_command 'precmd_xterm_title'
43+
safe_append_preexec 'preexec_xterm_title'
4444
;;
4545
esac

0 commit comments

Comments
 (0)