Browse Source

Merge branch 'master' of github.com:10sr/dotfiles

pull/1/head
10sr 11 years ago
parent
commit
c891709708
2 changed files with 26 additions and 10 deletions
  1. +13
    -7
      bashrc
  2. +13
    -3
      setup.sh

+ 13
- 7
bashrc View File

@@ -202,6 +202,11 @@ then
|| complete -o default -o nospace -F _git g || complete -o default -o nospace -F _git g
fi fi


scr(){
_time="%Y-%m-%dT%H:%M:%S%z"
script `date +${_time}`.script "$@"
}

netwait(){ netwait(){
while ! ping example.com -c 1 while ! ping example.com -c 1
do do
@@ -555,7 +560,8 @@ __my_ps1_scale(){
} }
__my_ps1_tmux(){ __my_ps1_tmux(){
local last=$? 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]" test -n "$TMUX" && echo "[TMUX:$tmuxc]"
return $last return $last
} }
@@ -565,12 +571,13 @@ __my_ps1_moc(){
return $last return $last
} }
test -r /usr/share/git/git-prompt.sh && . /usr/share/git/git-prompt.sh 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(){ __my_ps1_git(){
local last=$? local last=$?
null type __git_ps1 || return $last null type __git_ps1 || return $last
null git status || return $last
test -n "`git status -s -uno`" && local star=\*
__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 return $last
} }
__my_ps1_ipaddr(){ __my_ps1_ipaddr(){
@@ -608,9 +615,8 @@ then
__my_cdef="\[\e[0m\]" __my_cdef="\[\e[0m\]"
fi fi
_PS1="\ _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:\$? \$ "
${__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 PS1=$_PS1


__my_set_title(){ __my_set_title(){


+ 13
- 3
setup.sh View File

@@ -3,6 +3,14 @@
mkdir -p ~/.my/log mkdir -p ~/.my/log
mkdir -p ~/.local/bin mkdir -p ~/.local/bin


_iswindows(){
case `uname` in
(CYGWIN*) return 0;;
(MINGW*) return 0;;
esac
return 1
}

gen_source_script(){ gen_source_script(){
# _gen_source_script file lines # _gen_source_script file lines
test $# -eq 2 || return 1 test $# -eq 2 || return 1
@@ -48,9 +56,10 @@ git_config(){
git config --global status.relativePaths false git config --global status.relativePaths false
git config --global status.showUntrackedFiles normal git config --global status.showUntrackedFiles normal
git config --global log.date iso 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.st "status -s -b"
git config --global alias.b "branch" git config --global alias.b "branch"
git config --global alias.sb "show-branch"
git config --global alias.ci "commit --verbose" git config --global alias.ci "commit --verbose"
git config --global alias.co "checkout" git config --global alias.co "checkout"
git config --global alias.cim "commit --verbose -m" git config --global alias.cim "commit --verbose -m"
@@ -62,7 +71,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.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.addi "add -i"
git config --global alias.clean-p "!test -z \"\$(git status -s -uno)\"" 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 git config --global core.fileMode false
fi fi
} }
@@ -89,7 +98,8 @@ mac_start_daemon(){
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist 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 git_config




Loading…
Cancel
Save