From 3fa79eb14a4c0244fb2dc4a5b805b7cffaa63770 Mon Sep 17 00:00:00 2001 From: typebrook Date: Mon, 24 Feb 2020 13:59:25 +0800 Subject: update --- alias | 77 +++++++++++++++++++++++++------------------------- gitconfig | 2 ++ scripts/check_upstream | 2 +- tigrc | 3 +- 4 files changed, 43 insertions(+), 41 deletions(-) diff --git a/alias b/alias index d264cb4..ebd31c9 100644 --- a/alias +++ b/alias @@ -14,11 +14,10 @@ alias log="cat $SETTING_DIR/log | grep '`date +'%b %d'`'" # vim alias v='vim' alias vv='vim ~/vimwiki/index.md' -alias ve='vim ~/.vim_runtime/my_configs.vim' alias vr='vim -R' alias cdv='cd ~/.vim_runtime' # amix/vimrc repo -# script +# for custom scripts vs() { which $1 && vim $(which $1) } @@ -55,7 +54,7 @@ prompt() { alias ai='sudo apt install' # apt install alias aptu='sudo apt update && sudo apt upgrade' alias si='sudo snap install' # snap install -alias pi='sudo pip3 install' # nodejs install +alias pi='sudo pip3 install' # python install alias ni='sudo npm install -g' # nodejs install # cd to DIRs @@ -70,6 +69,18 @@ alias cdD='cd ~/Documents' alias cdP='cd ~/Pictures' alias cdV='cd ~/Videos' +# git +unalias gc &> /dev/null # override zsh plugin alias +gc() { + git clone $1 && cd $(basename $1) +} +gc1() { + git clone --depth=1 $1 && cd $(basename $1) +} +alias gls='git log -S' +alias cdgw='cd .github/workflows' +alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule + # github GITHUB_API='https://api.github.com' GITHUB_API_TOKEN=$(cat $SETTING_DIR/tokens/github 2>/dev/null) @@ -78,11 +89,34 @@ alias github_token='xdg-open https://github.com/settings/tokens' github() { xdg-open https://github.com/$1/$2 } +gcg() { + git clone git@github.com:$1/$2.git && cd $(basename $2) +} +github_release_asset() { + command="upload-github-release-asset.sh\n github_api_token=$GITHUB_API_TOKEN\n owner=typebrook\n repo=tig\n tag=LATEST\n filename=$(which tig)\n overwrite=false" + prompt "$command" +} + +# tig +alias cdt='cd ~/git/tig' +alias t='tig' +alias ts='tig status' +alias ta='tig --all' +alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' +upload_tig() { + upload-github-release-asset.sh \ + github_api_token=$GITHUB_API_TOKEN \ + owner=typebrook \ + repo=tig \ + tag=LATEST \ + filename=$(which tig) + overwrite=false +} # about custom settings alias cds="cd $SETTING_DIR" alias cdss="cd $SETTING_DIR/scripts" -alias chs="cd $SETTING_DIR && tig status" # check setting changes +alias chs="cd $SETTING_DIR && tig status" # about vimwiki alias cdw='cd ~/vimwiki' @@ -114,25 +148,6 @@ _ranger_cd() { # disk alias df='df -h' -# git -unalias gc &> /dev/null # override zsh plugin alias -gc() { - git clone $1 && cd $(basename $1) -} -gc1() { - git clone --depth=1 $1 && cd $(basename $1) -} -gcg() { - git clone git@github.com:$1/$2.git && cd $(basename $2) -} -alias gls='git log -S' -alias cdgw='cd .github/workflows' -alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule -github_release_asset() { - command="upload-github-release-asset.sh\n github_api_token=$GITHUB_API_TOKEN\n owner=typebrook\n repo=tig\n tag=LATEST\n filename=$(which tig)\n overwrite=false" - prompt "$command" -} - # docker alias dp='docker ps' alias dpa='docker ps -a' @@ -149,22 +164,6 @@ alias ptt='ssh bbsu@ptt.cc' alias geothings='ssh geothings@geobingan.info' alias geothings-test='ssh geothings@test.geothings.tw' -# tig -alias cdt='cd ~/git/tig' -alias t='tig' -alias ts='tig status' -alias ta='tig --all' -alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' -upload_tig() { - upload-github-release-asset.sh \ - github_api_token=$(cat ~/settings/tokens/github) \ - owner=typebrook \ - repo=tig \ - tag=LATEST \ - filename=$(which tig) - overwrite=false -} - # Android alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' alias adb_default='adb shell dumpsys package domain-preferred-apps' diff --git a/gitconfig b/gitconfig index 3b07eab..ebe0ed1 100644 --- a/gitconfig +++ b/gitconfig @@ -19,3 +19,5 @@ [color] ui = off +[credential] + helper = store diff --git a/scripts/check_upstream b/scripts/check_upstream index 02c3f87..3313e5b 100755 --- a/scripts/check_upstream +++ b/scripts/check_upstream @@ -18,7 +18,7 @@ cd "$1" && \ git fetch origin && \ if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null then - [ $(git pull my) = 'Alrady up to date.' ] || \ + [[ $(git pull my) == 'Alrady up to date.' ]] || \ echo "New commit at" "$1" fi diff --git a/tigrc b/tigrc index c42fbb9..070fe9b 100644 --- a/tigrc +++ b/tigrc @@ -95,7 +95,8 @@ bind main 1 +sh -c "git rev-list --all --children | \ bind main b none bind main bn @git branch "%(prompt Enter branch name: )" %(commit) bind main bN @git branch %(branch) --track %(remote)/%(branch) -bind main bu @git branch --set-upstream-to="%(prompt Set remote/branch: )"/%(branch) %(branch) +bind main bu @git branch --set-upstream-to="%(prompt Set remote: )"/%(branch) %(branch) +bind main bU @git branch --set-upstream-to="%(prompt Set remote/branch: )" %(branch) bind main bc @git checkout -b "%(prompt Checkout at new branch: )" %(commit) bind generic bd @git branch -d "%(prompt Delete branch: )" bind main bbd @git branch -d %(branch) -- cgit v1.2.3-70-g09d2