-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
149 lines (120 loc) · 3.71 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
# ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
ZSH_THEME="spaceship"
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
zsh-z
)
# https://ohmyz.sh/
# 1、sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# 2、sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
source $ZSH/oh-my-zsh.sh
# -------------------------------- #
# Node Package Manager
# -------------------------------- #
# https://github.com/antfu/ni
# npm i -g @antfu/ni
alias nio="ni --prefer-offline"
alias s="nr start"
alias d="nr dev"
alias b="nr build"
alias bw="nr build --watch"
alias t="nr test"
alias tu="nr test -u"
alias tw="nr test --watch"
alias w="nr watch"
alias p="nr play"
alias c="nr typecheck"
alias lint="nr lint"
alias lintf="nr lint --fix"
alias release="nr release"
alias re="nr release"
# -------------------------------- #
# Git
# -------------------------------- #
# Use github/hub
# https://github.com/github/hub
# brew install hub
alias git=hub
# Go to project root
alias grt='cd "$(git rev-parse --show-toplevel)"'
alias gs='git status'
alias gp='git push'
alias gpf='git push --force'
alias gpft='git push --follow-tags'
alias gpl='git pull --rebase'
alias gcl='git clone'
alias gst='git stash'
alias grm='git rm'
alias gmv='git mv'
alias main='git checkout main'
alias master='git checkout master'
alias release='git checkout release'
alias prev='git checkout prev'
alias test='git checkout test'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gb='git branch'
alias gbd='git branch -d'
alias gbD='git branch -D'
# Delete all Git branches except the currently active branch
alias gbDA='git branch | grep -v "^*" | xargs git branch -D'
alias gbm='git branch -m'
alias gbM='git branch -M'
alias gm='git merge'
alias grb='git rebase'
alias grbom='git rebase origin/master'
alias grbc='git add . && git rebase --continue'
alias gl='git log'
alias glo='git log --oneline --graph'
alias grh='git reset HEAD'
alias grh1='git reset HEAD~1'
alias ga='git add'
alias gA='git add -A'
alias gc='git commit'
alias gcm='git commit -m'
alias gca='git commit -a'
alias gcae="git commit --amend"
alias gcam='git add -A && git commit -m'
alias gfrb='git fetch origin && git rebase origin/master'
alias gxn='git clean -dn'
alias gx='git clean -df'
# Copy the hash value of the most recent commit
alias gsha='git rev-parse HEAD | pbcopy'
# -------------------------------- #
# Npm
# -------------------------------- #
alias nstb='npm config set registry https://registry.npm.taobao.org'
alias nsn='npm config set registry https://registry.npmjs.org'
# -------------------------------- #
# Directories
#
# I put
# `~/code` for my projects
# -------------------------------- #
function cc() {
cd ~/code/$1
}
function ccc() {
cd ~/code/company_code/$1
}
function ccg() {
cd ~/code/github/$1
}
function dir() {
mkdir $1 && cd $1
}
# get project branch
function gbp(){
node ~/code/company_code/getBranch.js
}
# nvm
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion