From a2e2018fe651d9343eeb79d1ff0a74a94ca8f390 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Aug 2012 12:47:56 +0900 Subject: [PATCH 1/4] update o --- bashrc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/bashrc b/bashrc index b7fcf52..97260ba 100755 --- a/bashrc +++ b/bashrc @@ -331,9 +331,9 @@ _open_file(){ elif islinux then if null type pcmanfm; then - LC_MESSAGES= pcmanfm "$@" & + LC_MESSAGES= pcmanfm "$@" else - LC_MESSAGES= xdg-open "$@" + LC_MESSAGES= xdg-open "$@" & fi else cat "$@" @@ -347,12 +347,7 @@ o(){ else for f in "$@" do - if test -d "$f" - then - _open_file "$f" - else - _open_file "$f" - fi + _open_file "$f" done fi } From 7f50031a77741725208c47bd37b780b142a31372 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Aug 2012 13:31:15 +0900 Subject: [PATCH 2/4] show tmux info when using tmux --- bashrc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 97260ba..99f23f3 100755 --- a/bashrc +++ b/bashrc @@ -454,6 +454,14 @@ ip-address(){ test -n "$ip" && printf $1 $ip } +__my_ps1_tmux(){ + local last=$? + if test -n "$TMUX" + then + echo "[TMUX:$TMUX_PANE]" + fi + return $last +} __my_ps1_moc(){ local last=$? __my_moc_state "[MOC:%s]" @@ -461,6 +469,7 @@ __my_ps1_moc(){ } __my_ps1_git(){ local last=$? + null type __git_ps1 || return $last __try_exec __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" return $last } @@ -495,7 +504,7 @@ then __my_cdef="\[\e[0m\]" fi _PS1="\ -${__my_c4}:: ${__my_cdef}[${__my_c1}\w/${__my_cdef}<${__my_c3}\${OLDPWD}${__my_cdef}]\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ +${__my_c4}:: ${__my_cdef}[${__my_c1}\w/${__my_cdef}<${__my_c3}\${OLDPWD}${__my_cdef}]\$(__my_ps1_tmux)\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ ${__my_c4}:: ${__my_c2}\u@\H${__my_cdef} \D{%a, %d %b %Y %T %z} ${SHELL} \V\n\ ${__my_c4}:: ${__my_cdef}shlv:${SHLVL} cnum:\# jobs:\j last:\$? \$ " PS1=$_PS1 From 7aeaba75cc19f46417a834fbd3cc3f1ee3d41be9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Aug 2012 14:35:26 +0900 Subject: [PATCH 3/4] update __my_ps1_tmux --- bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 99f23f3..9e22028 100755 --- a/bashrc +++ b/bashrc @@ -454,11 +454,12 @@ ip-address(){ test -n "$ip" && printf $1 $ip } +TMUX_CURRENT=$(tmux display -p '#S:#I:#W.#P') __my_ps1_tmux(){ local last=$? if test -n "$TMUX" then - echo "[TMUX:$TMUX_PANE]" + echo "[TMUX:$TMUX_CURRENT]" fi return $last } From 0f5a89f0f632f785af1cca5f5a240c99012a80bf Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Tue, 21 Aug 2012 14:38:05 +0900 Subject: [PATCH 4/4] fix __my_ps1_tmux --- bashrc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bashrc b/bashrc index 9e22028..48bdb56 100755 --- a/bashrc +++ b/bashrc @@ -454,13 +454,10 @@ ip-address(){ test -n "$ip" && printf $1 $ip } -TMUX_CURRENT=$(tmux display -p '#S:#I:#W.#P') +TMUX_CURRENT="$(__try_exec tmux display -p '#S:#I:#W.#P')" __my_ps1_tmux(){ local last=$? - if test -n "$TMUX" - then - echo "[TMUX:$TMUX_CURRENT]" - fi + test -n "$TMUX" && echo "[TMUX:$TMUX_CURRENT]" return $last } __my_ps1_moc(){