From fd13f07c43025e8487c24f08ae169bc2f7ea1d28 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 12 Apr 2013 21:28:07 +0900 Subject: [PATCH 1/3] use = instead of == --- bashrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 2d01c1c..0b47831 100755 --- a/bashrc +++ b/bashrc @@ -117,7 +117,7 @@ fi ################################### # some aliases and functions -( ! with_coreutils && isdarwin ) || test "$TERM" == dumb || \ +( ! with_coreutils && isdarwin ) || test "$TERM" = dumb || \ _coloroption=" --color=auto" ( ! with_coreutils && isdarwin ) || iswindows || \ _timeoption=" --time-style=long-iso" @@ -649,7 +649,7 @@ winln(){ __my_moc_state(){ type mocp >/dev/null 2>&1 || return - test "`mocp -Q %state 2>/dev/null`" == PLAY || return + test "`mocp -Q %state 2>/dev/null`" = PLAY || return printf "$1" "`mocp -Q %title 2>/dev/null`" } From aa362ac42a5efce0f73037d3a69bf174d767be6f Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 12 Apr 2013 21:38:52 +0900 Subject: [PATCH 2/3] add alias inbash and bashrc seems to work with zsh --- bashrc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bashrc b/bashrc index 0b47831..ff6ab38 100755 --- a/bashrc +++ b/bashrc @@ -31,6 +31,10 @@ null ls --version && alias with_coreutils=true ( ismsys || iscygwin ) && alias iswindows=true +alias inbash=false + +test -n "$BASH_VERSION" && alias inbash=true + ################################# if echo $PATH | grep "$HOME" >/dev/null 2>&1 @@ -80,8 +84,6 @@ mkdir -p "$TMP" } if iswindows; then - # export PS1=" \[\e[32m\]\u@\H \[\e[33m\]\w\[\e[0m\] \d \t\n\s \# \j \$ " - # export PS1=" [\[\e[33m\]\w\[\e[0m\]]\n\[\e[32m\]\u@\H\[\e[0m\] \d \t \s.\v\nhist:\# jobs:\j \$ " export USER=$USERNAME fi @@ -253,7 +255,7 @@ g(){ git "$@" fi } -if null type _git +if null type _git && inbash then # enable programmable completion for g complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ @@ -807,4 +809,3 @@ __my_set_title(){ } PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\:\${PWD}; __my_set_screen_title \$(basename \"\$PWD\")/" - From ed896b68c2190a8a51f542e625b243e2d2980ec6 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 12 Apr 2013 22:53:16 +0900 Subject: [PATCH 3/3] add inzsh alias --- bashrc | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/bashrc b/bashrc index ff6ab38..564ed14 100755 --- a/bashrc +++ b/bashrc @@ -32,8 +32,15 @@ null ls --version && alias with_coreutils=true ( ismsys || iscygwin ) && alias iswindows=true alias inbash=false +alias inzsh=false -test -n "$BASH_VERSION" && alias inbash=true +if test -n "$BASH_VERSION" +then + alias inbash=true +elif test -n "$ZSH_VERSION" +then + alias inzsh=true +fi ################################# @@ -588,29 +595,6 @@ convmv-sjis2utf8-notest(){ convmv -r -f sjis -t utf8 * --notest } -#Change ANSI Colors -_chengecolors(){ - echo -e \ - "\e]P0000000" \ - "\e]P1cd0000" \ - "\e]P200cd00" \ - "\e]P3cdcd00" \ - "\e]P41e90ff" \ - "\e]P5cd00cd" \ - "\e]P600cdcd" \ - "\e]P7353535" \ - "\e]P8666666" \ - "\e]P9ff9999" \ - "\e]Pa99ff99" \ - "\e]Pbffff99" \ - "\e]Pc9999ff" \ - "\e]Pdff99ff" \ - "\e]Pe99ffff" \ - "\e]Pfffffff" -} - -# printf "\e]P7353535" \ - _colors(){ echo -e \ "\e[30mBlack" \ @@ -784,10 +768,10 @@ __my_export_last_status(){ return $_LAST_STATUS } -_PS1="\ +_ps1_bash="\ ${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ ${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? $(__my_ps1_scale) \D{%T} $(__my_ps1_script)\$ " -PS1=$_PS1 +inbash && PS1=$_ps1_bash __my_set_screen_title(){ if test -n "$TMUX" && test -z "$INSIDE_EMACS"