From 162bbbe64aa3f5c02acad7cd46305d6c070b9005 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 19:49:01 +0900 Subject: [PATCH 01/10] add _iswindows func in setup.sh --- setup.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 513bda4..d8c7c7a 100755 --- a/setup.sh +++ b/setup.sh @@ -3,6 +3,14 @@ mkdir -p ~/.my/log mkdir -p ~/.local/bin +_iswindows(){ + case `uname` in + (CYGWIN*) return 0;; + (MINGW*) return 0;; + esac + return 1 +} + gen_source_script(){ # _gen_source_script file lines test $# -eq 2 || return 1 @@ -62,7 +70,7 @@ git_config(){ # git config --global alias.ll "!git ls-files | xargs ls -l -CFG --color=auto --time-style=long-iso" git config --global alias.addi "add -i" git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\"" - if false iswindows; then + if _iswindows; then git config --global core.fileMode false fi } From 9bb66de5134f2d6348b20b7c41675379104a84b4 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 19:49:47 +0900 Subject: [PATCH 02/10] limit object to 500 when git graph --- setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index d8c7c7a..83c321d 100755 --- a/setup.sh +++ b/setup.sh @@ -56,7 +56,7 @@ git_config(){ git config --global status.relativePaths false git config --global status.showUntrackedFiles normal git config --global log.date iso - git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso" + git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso -n 500" git config --global alias.st "status -s -b" git config --global alias.b "branch" git config --global alias.ci "commit --verbose" From eca024e6c2afa29c89c71ecd2a2cf26740af2047 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 19:53:26 +0900 Subject: [PATCH 03/10] split annoying long line --- setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.sh b/setup.sh index 83c321d..517575f 100755 --- a/setup.sh +++ b/setup.sh @@ -97,7 +97,8 @@ mac_start_daemon(){ sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist } -get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh http://www.frexx.de/xterm-256-notes/data/256colors2.pl +get_install_script http://www.frexx.de/xterm-256-notes/data/colortable16.sh \ + http://www.frexx.de/xterm-256-notes/data/256colors2.pl git_config From 6745a948b608714cc146e360eb597456e76c0f88 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 20:13:00 +0900 Subject: [PATCH 04/10] update __my_ps1_git --- bashrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 53318a1..c94184c 100755 --- a/bashrc +++ b/bashrc @@ -567,11 +567,13 @@ __my_ps1_moc(){ return $last } test -r /usr/share/git/git-prompt.sh && . /usr/share/git/git-prompt.sh +GIT_PS1_SHOWDIRTYSTATE=t +GIT_PS1_SHOWUPSTREAM=t __my_ps1_git(){ local last=$? null type __git_ps1 || return $last - null git status || return $last - test -n "`git status -s -uno`" && local star=\* + null git status || return $last # __gitdir seems to be able to be used + #test -n "`git status -s -uno`" && local star=\* # done by SHOWDIRTYSTATE __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s${star}]" return $last } From 64d0803e1345c7124998cd0caa1865def8ad9e07 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 22:53:14 +0900 Subject: [PATCH 05/10] use __gitdir for detecting git rep --- bashrc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bashrc b/bashrc index c94184c..0de6e2c 100755 --- a/bashrc +++ b/bashrc @@ -572,9 +572,8 @@ GIT_PS1_SHOWUPSTREAM=t __my_ps1_git(){ local last=$? null type __git_ps1 || return $last - null git status || return $last # __gitdir seems to be able to be used - #test -n "`git status -s -uno`" && local star=\* # done by SHOWDIRTYSTATE - __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s${star}]" + null __gitdir || return $last + __git_ps1 "[GIT:$(__try_exec git config --get user.name):%s]" return $last } __my_ps1_ipaddr(){ From 18277f0453299807a9c080739aca9018513689b9 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 14 Sep 2012 22:57:40 +0900 Subject: [PATCH 06/10] update __my_ps1_tmux --- bashrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 0de6e2c..e911517 100755 --- a/bashrc +++ b/bashrc @@ -557,7 +557,8 @@ __my_ps1_scale(){ } __my_ps1_tmux(){ local last=$? - local tmuxc="$(__try_exec tmux display -p '#S:#I:#W.#P' 2>/dev/null)" + null type tmux || return $last + local tmuxc="$(tmux display -p '#S:#I:#W.#P' 2>/dev/null)" test -n "$TMUX" && echo "[TMUX:$tmuxc]" return $last } From b1e3fa5098979b963a79e5ca7fede69c9e86a449 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sat, 15 Sep 2012 15:07:34 +0900 Subject: [PATCH 07/10] add git alias sb as show-branch --- setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.sh b/setup.sh index 517575f..384ad1a 100755 --- a/setup.sh +++ b/setup.sh @@ -59,6 +59,7 @@ git_config(){ git config --global alias.graph "log --graph --date-order -C -M --pretty=tformat:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=iso -n 500" git config --global alias.st "status -s -b" git config --global alias.b "branch" + git config --global alias.sb "show-branch" git config --global alias.ci "commit --verbose" git config --global alias.co "checkout" git config --global alias.cim "commit --verbose -m" From 30fc401447d93f0ce1164cb59820ef6ee0c84c1b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Sun, 16 Sep 2012 15:00:28 +0900 Subject: [PATCH 08/10] add func scr --- bashrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bashrc b/bashrc index e911517..9b3c59d 100755 --- a/bashrc +++ b/bashrc @@ -204,6 +204,11 @@ then || complete -o default -o nospace -F _git g fi +scr(){ + _time="%Y-%m-%dT%H:%M:%S%z" + script `date +${_time}`.script "$@" +} + netwait(){ while ! ping example.com -c 1 do From 8edd080c109edf1f576acbae693b362fa357c75b Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 17 Sep 2012 20:11:40 +0900 Subject: [PATCH 09/10] big update of PS1 --- bashrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bashrc b/bashrc index 9b3c59d..ee4b6c1 100755 --- a/bashrc +++ b/bashrc @@ -616,10 +616,9 @@ then fi __my_cdef="\[\e[0m\]" fi -_PS1="\ -${__my_c4}:: ${__my_cdef}[${__my_c1}\w/${__my_cdef}<${__my_c3}\${OLDPWD}${__my_cdef}]\$(__my_ps1_scale)\$(__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="$(__my_ps1_save_last)\ +${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_scale)\$(__my_ps1_tmux)\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ +${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? \D{%T} \$ " PS1=$_PS1 __my_set_title(){ From 46ffe17934451e19831884a1a42a4c2e10608d0c Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 17 Sep 2012 22:39:58 +0900 Subject: [PATCH 10/10] fix PS1 --- bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bashrc b/bashrc index ee4b6c1..74111f6 100755 --- a/bashrc +++ b/bashrc @@ -616,7 +616,7 @@ then fi __my_cdef="\[\e[0m\]" fi -_PS1="$(__my_ps1_save_last)\ +_PS1="\ ${__my_c4}:: ${__my_cdef}[${__my_c2}\u@\H${__my_cdef}:${__my_c1}\w/${__my_cdef}]\$(__my_ps1_scale)\$(__my_ps1_tmux)\$(__my_ps1_git)\$(__my_ps1_bttry)\$(__my_ps1_ipaddr)\$(__my_ps1_moc)\n\ ${__my_c4}:: ${__my_cdef}l${SHLVL}n\#j\js\$? \D{%T} \$ " PS1=$_PS1