Skip to content

Instantly share code, notes, and snippets.

@cosmo0920
Created June 16, 2012 19:50
Show Gist options
  • Save cosmo0920/2942355 to your computer and use it in GitHub Desktop.
Save cosmo0920/2942355 to your computer and use it in GitHub Desktop.
使い慣れている表示っぽくなったヾ(@⌒ー⌒@)ノ
setopt prompt_subst
## プロンプトの設定
autoload colors
colors
PROMPT="%n@`hostname -s`:%~%%"
PROMPT2='>> '
if [ "$TERM" = "xterm" -o "$TERM" = "kterm" ]
then
hostname=`hostname -s`
function _setcaption() { echo -ne "\e]1;${hostname}\a\e]2;${hostname}$1\a" > /dev/tty }
# ディレクトリを移動したら、ウィンドウのタイトルを
# ホスト名:現在地 のように変更
function chpwd() { print -Pn "\e]2; %n@%m %~\a" }
# 初期設定してあげる(cd . でも可)
chpwd
# 特定のコマンド実行中は、タイトルを ホスト名 (コマンド 名) のように
# 変更
function _cmdcaption() { _setcaption " ($1)"; "$@"; chpwd }
for cmd in telnet slogin ssh rlogin rsh su sudo
do
alias $cmd="_cmdcaption $cmd"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment