projects
/
dotfiles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
301899c
)
tmux - show ip and hostname
author
Peng Li
<seudut@gmail.com>
Sat, 23 Jun 2018 14:21:08 +0000
(22:21 +0800)
committer
Peng Li
<seudut@gmail.com>
Sat, 23 Jun 2018 14:24:19 +0000
(22:24 +0800)
tmux.conf
patch
|
blob
|
history
zsh/zshrc
patch
|
blob
|
history
diff --git
a/tmux.conf
b/tmux.conf
index
625b3c5
..
ee40011
100755
(executable)
--- a/
tmux.conf
+++ b/
tmux.conf
@@
-18,9
+18,8
@@
set-window-option -g window-status-current-bg red
#set-option -g status-right "#[fg=green]#T #[fg=yellow,bold]#(date '+%Y-%m-%d %I:%M%P %a') "
#set-option -g status-right "#[fg=green]#(whoami) #[fg=yellow,bold]#(date '+%Y-%m-%d') #[fg=red,bold]#(date '+%I:%M') #[fg=yellow,bold]#(date '+%p %a') "
set-option -g status-right-length 60
#set-option -g status-right "#[fg=green]#T #[fg=yellow,bold]#(date '+%Y-%m-%d %I:%M%P %a') "
#set-option -g status-right "#[fg=green]#(whoami) #[fg=yellow,bold]#(date '+%Y-%m-%d') #[fg=red,bold]#(date '+%I:%M') #[fg=yellow,bold]#(date '+%p %a') "
set-option -g status-right-length 60
-set-option -g status-right "#[fg=red]#(hostname) #[fg=red]#(echo $SSH_CONNECTION | awk '{print $3}') #[fg=yellow]#(date '+%Y-%m-%d') #[fg=red]#(date '+%I:%M') #[fg=yellow]#(date '+%p %a') "
-if-shell 'test "$(uname)" = "Darwin"' 'set -g status-bg black'
-if-shell 'test "$(uname)" = "Linux"' 'set -g status-bg blue'
+set-option -g status-right "#[fg=yellow]#h #[fg=red]#(echo $TMUX_IP) #[fg=yellow]#(date '+%Y-%m-%d') #[fg=red]#(date '+%I:%M') #[fg=yellow]#(date '+%p %a') "
+if-shell 'test "$(uname)" = "Darwin"' 'set -g status-bg black' 'set -g status-bg blue'
## automatic change the window title
#set-option -g set-titles on
## automatic change the window title
#set-option -g set-titles on
diff --git
a/zsh/zshrc
b/zsh/zshrc
index
8162a2f
..
71f1954
100644
(file)
--- a/
zsh/zshrc
+++ b/
zsh/zshrc
@@
-334,3
+334,14
@@
export PATH="$HOME/.bin":$PATH;
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
+
+# tmux variable
+export TMUX_IP=`echo $SSH_CONNECTION | awk '{print $3}'`
+if [[ $OSNAME == 'Darwin' ]]; then
+ ip=`ifconfig | grep "inet .*broadcast" | head -1 | awk '{print $2}'`
+ [[ $TMUX_IP = "" ]] && TMUX_IP=$ip
+else
+ ip=`ip addr | grep 'inet .*global' | head -1 | sed 's/^.*inet //g; s/\/.*$//g'`
+ [[ $TMUX_IP = "" ]] && TMUX_IP=$ip
+fi
+