diff options
author | typebrook <typebrook@gmail.com> | 2020-02-24 13:59:25 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-02-24 13:59:25 +0800 |
commit | 3fa79eb14a4c0244fb2dc4a5b805b7cffaa63770 (patch) | |
tree | 0d9a3a7ebcf538af3f21aba85eb2075e01e86421 | |
parent | 08ccb874cdc465eda46506f284ee14b244c0cf4b (diff) |
update
-rw-r--r-- | alias | 77 | ||||
-rw-r--r-- | gitconfig | 2 | ||||
-rwxr-xr-x | scripts/check_upstream | 2 | ||||
-rw-r--r-- | tigrc | 3 |
4 files changed, 43 insertions, 41 deletions
@@ -14,11 +14,10 @@ alias log="cat $SETTING_DIR/log | grep '`date +'%b %d'`'" | |||
14 | # vim | 14 | # vim |
15 | alias v='vim' | 15 | alias v='vim' |
16 | alias vv='vim ~/vimwiki/index.md' | 16 | alias vv='vim ~/vimwiki/index.md' |
17 | alias ve='vim ~/.vim_runtime/my_configs.vim' | ||
18 | alias vr='vim -R' | 17 | alias vr='vim -R' |
19 | alias cdv='cd ~/.vim_runtime' # amix/vimrc repo | 18 | alias cdv='cd ~/.vim_runtime' # amix/vimrc repo |
20 | 19 | ||
21 | # script | 20 | # for custom scripts |
22 | vs() { | 21 | vs() { |
23 | which $1 && vim $(which $1) | 22 | which $1 && vim $(which $1) |
24 | } | 23 | } |
@@ -55,7 +54,7 @@ prompt() { | |||
55 | alias ai='sudo apt install' # apt install | 54 | alias ai='sudo apt install' # apt install |
56 | alias aptu='sudo apt update && sudo apt upgrade' | 55 | alias aptu='sudo apt update && sudo apt upgrade' |
57 | alias si='sudo snap install' # snap install | 56 | alias si='sudo snap install' # snap install |
58 | alias pi='sudo pip3 install' # nodejs install | 57 | alias pi='sudo pip3 install' # python install |
59 | alias ni='sudo npm install -g' # nodejs install | 58 | alias ni='sudo npm install -g' # nodejs install |
60 | 59 | ||
61 | # cd to DIRs | 60 | # cd to DIRs |
@@ -70,6 +69,18 @@ alias cdD='cd ~/Documents' | |||
70 | alias cdP='cd ~/Pictures' | 69 | alias cdP='cd ~/Pictures' |
71 | alias cdV='cd ~/Videos' | 70 | alias cdV='cd ~/Videos' |
72 | 71 | ||
72 | # git | ||
73 | unalias gc &> /dev/null # override zsh plugin alias | ||
74 | gc() { | ||
75 | git clone $1 && cd $(basename $1) | ||
76 | } | ||
77 | gc1() { | ||
78 | git clone --depth=1 $1 && cd $(basename $1) | ||
79 | } | ||
80 | alias gls='git log -S' | ||
81 | alias cdgw='cd .github/workflows' | ||
82 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | ||
83 | |||
73 | # github | 84 | # github |
74 | GITHUB_API='https://api.github.com' | 85 | GITHUB_API='https://api.github.com' |
75 | GITHUB_API_TOKEN=$(cat $SETTING_DIR/tokens/github 2>/dev/null) | 86 | 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' | |||
78 | github() { | 89 | github() { |
79 | xdg-open https://github.com/$1/$2 | 90 | xdg-open https://github.com/$1/$2 |
80 | } | 91 | } |
92 | gcg() { | ||
93 | git clone git@github.com:$1/$2.git && cd $(basename $2) | ||
94 | } | ||
95 | github_release_asset() { | ||
96 | 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" | ||
97 | prompt "$command" | ||
98 | } | ||
99 | |||
100 | # tig | ||
101 | alias cdt='cd ~/git/tig' | ||
102 | alias t='tig' | ||
103 | alias ts='tig status' | ||
104 | alias ta='tig --all' | ||
105 | alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' | ||
106 | upload_tig() { | ||
107 | upload-github-release-asset.sh \ | ||
108 | github_api_token=$GITHUB_API_TOKEN \ | ||
109 | owner=typebrook \ | ||
110 | repo=tig \ | ||
111 | tag=LATEST \ | ||
112 | filename=$(which tig) | ||
113 | overwrite=false | ||
114 | } | ||
81 | 115 | ||
82 | # about custom settings | 116 | # about custom settings |
83 | alias cds="cd $SETTING_DIR" | 117 | alias cds="cd $SETTING_DIR" |
84 | alias cdss="cd $SETTING_DIR/scripts" | 118 | alias cdss="cd $SETTING_DIR/scripts" |
85 | alias chs="cd $SETTING_DIR && tig status" # check setting changes | 119 | alias chs="cd $SETTING_DIR && tig status" |
86 | 120 | ||
87 | # about vimwiki | 121 | # about vimwiki |
88 | alias cdw='cd ~/vimwiki' | 122 | alias cdw='cd ~/vimwiki' |
@@ -114,25 +148,6 @@ _ranger_cd() { | |||
114 | # disk | 148 | # disk |
115 | alias df='df -h' | 149 | alias df='df -h' |
116 | 150 | ||
117 | # git | ||
118 | unalias gc &> /dev/null # override zsh plugin alias | ||
119 | gc() { | ||
120 | git clone $1 && cd $(basename $1) | ||
121 | } | ||
122 | gc1() { | ||
123 | git clone --depth=1 $1 && cd $(basename $1) | ||
124 | } | ||
125 | gcg() { | ||
126 | git clone git@github.com:$1/$2.git && cd $(basename $2) | ||
127 | } | ||
128 | alias gls='git log -S' | ||
129 | alias cdgw='cd .github/workflows' | ||
130 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | ||
131 | github_release_asset() { | ||
132 | 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" | ||
133 | prompt "$command" | ||
134 | } | ||
135 | |||
136 | # docker | 151 | # docker |
137 | alias dp='docker ps' | 152 | alias dp='docker ps' |
138 | alias dpa='docker ps -a' | 153 | alias dpa='docker ps -a' |
@@ -149,22 +164,6 @@ alias ptt='ssh bbsu@ptt.cc' | |||
149 | alias geothings='ssh geothings@geobingan.info' | 164 | alias geothings='ssh geothings@geobingan.info' |
150 | alias geothings-test='ssh geothings@test.geothings.tw' | 165 | alias geothings-test='ssh geothings@test.geothings.tw' |
151 | 166 | ||
152 | # tig | ||
153 | alias cdt='cd ~/git/tig' | ||
154 | alias t='tig' | ||
155 | alias ts='tig status' | ||
156 | alias ta='tig --all' | ||
157 | alias get-tig='curl -LO https://github.com/typebrook/tig/releases/download/tig-2.5.0/tig' | ||
158 | upload_tig() { | ||
159 | upload-github-release-asset.sh \ | ||
160 | github_api_token=$(cat ~/settings/tokens/github) \ | ||
161 | owner=typebrook \ | ||
162 | repo=tig \ | ||
163 | tag=LATEST \ | ||
164 | filename=$(which tig) | ||
165 | overwrite=false | ||
166 | } | ||
167 | |||
168 | # Android | 167 | # Android |
169 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' | 168 | alias debug='./gradlew app:installDebug && adb shell am start -n com.geothings.geobingan/.MainActivity_' |
170 | alias adb_default='adb shell dumpsys package domain-preferred-apps' | 169 | alias adb_default='adb shell dumpsys package domain-preferred-apps' |
@@ -19,3 +19,5 @@ | |||
19 | 19 | ||
20 | [color] | 20 | [color] |
21 | ui = off | 21 | ui = off |
22 | [credential] | ||
23 | 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" && \ | |||
18 | git fetch origin && \ | 18 | git fetch origin && \ |
19 | if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null | 19 | if ! git rev-list "$head" | grep "$(git rev-parse origin/master)" > /dev/null |
20 | then | 20 | then |
21 | [ $(git pull my) = 'Alrady up to date.' ] || \ | 21 | [[ $(git pull my) == 'Alrady up to date.' ]] || \ |
22 | echo "New commit at" "$1" | 22 | echo "New commit at" "$1" |
23 | fi | 23 | fi |
24 | 24 | ||
@@ -95,7 +95,8 @@ bind main 1 +sh -c "git rev-list --all --children | \ | |||
95 | bind main b none | 95 | bind main b none |
96 | bind main bn @git branch "%(prompt Enter branch name: )" %(commit) | 96 | bind main bn @git branch "%(prompt Enter branch name: )" %(commit) |
97 | bind main bN @git branch %(branch) --track %(remote)/%(branch) | 97 | bind main bN @git branch %(branch) --track %(remote)/%(branch) |
98 | bind main bu @git branch --set-upstream-to="%(prompt Set remote/branch: )"/%(branch) %(branch) | 98 | bind main bu @git branch --set-upstream-to="%(prompt Set remote: )"/%(branch) %(branch) |
99 | bind main bU @git branch --set-upstream-to="%(prompt Set remote/branch: )" %(branch) | ||
99 | bind main bc @git checkout -b "%(prompt Checkout at new branch: )" %(commit) | 100 | bind main bc @git checkout -b "%(prompt Checkout at new branch: )" %(commit) |
100 | bind generic bd @git branch -d "%(prompt Delete branch: )" | 101 | bind generic bd @git branch -d "%(prompt Delete branch: )" |
101 | bind main bbd @git branch -d %(branch) | 102 | bind main bbd @git branch -d %(branch) |