├── README.md └── .zshrc /README.md: -------------------------------------------------------------------------------- 1 | # Anthony's Dotfiles 2 | 3 | - [.zshrc](./.zshrc) 4 | 5 | ### Check Also 6 | 7 | - [antfu/dotfiles](https://github.com/antfu/dotfiles) - My dotfiles 8 | - [antfu/vscode-settings](https://github.com/antfu/vscode-settings) - My VS Code settings 9 | - [antfu/eslint-config](https://github.com/antfu/eslint-config) - My ESLint config 10 | - [antfu/ts-starter](https://github.com/antfu/ts-starter) - My starter template for TypeScript library 11 | - [antfu/vitesse](https://github.com/antfu/vitesse) - My starter template for Vue & Vite app 12 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1 2 | # ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme" 3 | ZSH_THEME="spaceship" 4 | 5 | # git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions 6 | # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting 7 | # git clone https://github.com/agkozak/zsh-z $ZSH_CUSTOM/plugins/zsh-z 8 | plugins=( 9 | git 10 | zsh-autosuggestions 11 | zsh-syntax-highlighting 12 | zsh-z 13 | ) 14 | 15 | # https://ohmyz.sh/ 16 | source $ZSH/oh-my-zsh.sh 17 | 18 | # -------------------------------- # 19 | # Node Package Manager 20 | # -------------------------------- # 21 | # https://github.com/antfu/ni 22 | 23 | alias nio="ni --prefer-offline" 24 | alias s="nr start" 25 | alias d="nr dev" 26 | alias b="nr build" 27 | alias bw="nr build --watch" 28 | alias t="nr test" 29 | alias tu="nr test -u" 30 | alias tw="nr test --watch" 31 | alias w="nr watch" 32 | alias p="nr play" 33 | alias c="nr typecheck" 34 | alias lint="nr lint" 35 | alias lintf="nr lint --fix" 36 | alias release="nr release" 37 | alias re="nr release" 38 | 39 | # -------------------------------- # 40 | # Git 41 | # -------------------------------- # 42 | 43 | # Use github/hub 44 | alias git=hub 45 | 46 | # Go to project root 47 | alias grt='cd "$(git rev-parse --show-toplevel)"' 48 | 49 | alias gs='git status' 50 | alias gp='git push' 51 | alias gpf='git push --force' 52 | alias gpft='git push --follow-tags' 53 | alias gpl='git pull --rebase' 54 | alias gcl='git clone' 55 | alias gst='git stash' 56 | alias grm='git rm' 57 | alias gmv='git mv' 58 | 59 | alias main='git checkout main' 60 | 61 | alias gco='git checkout' 62 | alias gcob='git checkout -b' 63 | 64 | alias gb='git branch' 65 | alias gbd='git branch -d' 66 | 67 | alias grb='git rebase' 68 | alias grbom='git rebase origin/master' 69 | alias grbc='git rebase --continue' 70 | 71 | alias gl='git log' 72 | alias glo='git log --oneline --graph' 73 | 74 | alias grh='git reset HEAD' 75 | alias grh1='git reset HEAD~1' 76 | 77 | alias ga='git add' 78 | alias gA='git add -A' 79 | 80 | alias gc='git commit' 81 | alias gcm='git commit -m' 82 | alias gca='git commit -a' 83 | alias gcam='git add -A && git commit -m' 84 | alias gfrb='git fetch origin && git rebase origin/master' 85 | 86 | alias gxn='git clean -dn' 87 | alias gx='git clean -df' 88 | 89 | alias gsha='git rev-parse HEAD | pbcopy' 90 | 91 | alias ghci='gh run list -L 1' 92 | 93 | function glp() { 94 | git --no-pager log -$1 95 | } 96 | 97 | function gd() { 98 | if [[ -z $1 ]] then 99 | git diff --color | diff-so-fancy 100 | else 101 | git diff --color $1 | diff-so-fancy 102 | fi 103 | } 104 | 105 | function gdc() { 106 | if [[ -z $1 ]] then 107 | git diff --color --cached | diff-so-fancy 108 | else 109 | git diff --color --cached $1 | diff-so-fancy 110 | fi 111 | } 112 | 113 | # -------------------------------- # 114 | # Directories 115 | # 116 | # I put 117 | # `~/i` for my projects 118 | # `~/f` for forks 119 | # `~/r` for reproductions 120 | # -------------------------------- # 121 | 122 | function i() { 123 | cd ~/i/$1 124 | } 125 | 126 | function repros() { 127 | cd ~/r/$1 128 | } 129 | 130 | function forks() { 131 | cd ~/f/$1 132 | } 133 | 134 | function pr() { 135 | if [ $1 = "ls" ]; then 136 | gh pr list 137 | else 138 | gh pr checkout $1 139 | fi 140 | } 141 | 142 | function dir() { 143 | mkdir $1 && cd $1 144 | } 145 | 146 | function clone() { 147 | if [[ -z $2 ]] then 148 | hub clone "$@" && cd "$(basename "$1" .git)" 149 | else 150 | hub clone "$@" && cd "$2" 151 | fi 152 | } 153 | 154 | # Clone to ~/i and cd to it 155 | function clonei() { 156 | i && clone "$@" && code . && cd ~2 157 | } 158 | 159 | function cloner() { 160 | repros && clone "$@" && code . && cd ~2 161 | } 162 | 163 | function clonef() { 164 | forks && clone "$@" && code . && cd ~2 165 | } 166 | 167 | function codei() { 168 | i && code "$@" && cd - 169 | } 170 | 171 | function serve() { 172 | if [[ -z $1 ]] then 173 | live-server dist 174 | else 175 | live-server $1 176 | fi 177 | } 178 | --------------------------------------------------------------------------------