-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
63 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,32 @@ | ||
cite about-plugin | ||
about-plugin 'automatically set your xterm title with host and location info' | ||
|
||
|
||
_short-dirname () { | ||
local dir_name=`dirs +0` | ||
[ "$SHORT_TERM_LINE" = true ] && [ ${#dir_name} -gt 8 ] && echo ${dir_name##*/} || echo $dir_name | ||
_short-dirname() { | ||
local dir_name=$(dirs +0) | ||
[ "$SHORT_TERM_LINE" = true ] && [ "${#dir_name}" -gt 8 ] && echo "${dir_name##*/}" || echo "${dir_name}" | ||
} | ||
|
||
_short-command () { | ||
local input_command="$@" | ||
[ "$SHORT_TERM_LINE" = true ] && [ ${#input_command} -gt 8 ] && echo ${input_command%% *} || echo $input_command | ||
_short-command() { | ||
local input_command="$*" | ||
[ "$SHORT_TERM_LINE" = true ] && [ "${#input_command}" -gt 8 ] && echo "${input_command%% *}" || echo "${input_command}" | ||
} | ||
|
||
set_xterm_title () { | ||
local title="$1" | ||
echo -ne "\033]0;$title\007" | ||
set_xterm_title() { | ||
local title="$1" | ||
echo -ne "\033]0;$title\007" | ||
} | ||
|
||
precmd_xterm_title () { | ||
set_xterm_title "${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}} `_short-dirname` $PROMPTCHAR" | ||
precmd_xterm_title() { | ||
set_xterm_title "${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}} $(_short-dirname) $PROMPTCHAR" | ||
} | ||
|
||
preexec_xterm_title () { | ||
set_xterm_title "`_short-command $1` {`_short-dirname`} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})" | ||
preexec_xterm_title() { | ||
set_xterm_title "$(_short-command "${1}") {$(_short-dirname)} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})" | ||
} | ||
|
||
case "$TERM" in | ||
xterm*|rxvt*) | ||
precmd_functions+=(precmd_xterm_title) | ||
preexec_functions+=(preexec_xterm_title) | ||
;; | ||
xterm* | rxvt*) | ||
precmd_functions+=(precmd_xterm_title) | ||
preexec_functions+=(preexec_xterm_title) | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters