Skip to content

Instantly share code, notes, and snippets.

@hyoban
Last active April 21, 2024 07:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyoban/7943d4c59c43b79d3f8388671437fe11 to your computer and use it in GitHub Desktop.
Save hyoban/7943d4c59c43b79d3f8388671437fe11 to your computer and use it in GitHub Desktop.
Hyoban's dotfiles
[user]
name = Stephen Zhou
email = hi@hyoban.cc
signingkey = /Users/hyoban/.ssh/id_ed25519.pub
[init]
defaultBranch = main
[core]
excludesfile = ~/.gitignore_global
quotepath = false
[gpg]
format = ssh
[commit]
gpgsign = true
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
# https://starship.rs
# curl -sS https://starship.rs/install.sh | sh
eval "$(starship init zsh)"
# https://ohmyz.sh
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
export ZSH="$HOME/.oh-my-zsh"
# 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
plugins=(
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# https://bun.sh
# curl -fsSL https://bun.sh/install | bash
# bun completions
[ -s "/Users/hyoban/.bun/_bun" ] && source "/Users/hyoban/.bun/_bun"
# bun
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
# pnpm
export PNPM_HOME="/Users/hyoban/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# https://github.com/Schniz/fnm
# curl -fsSL https://fnm.vercel.app/install | bash
export PATH="/Users/hyoban/Library/Application Support/fnm:$PATH"
eval "$(fnm env --use-on-cd)"
export DENO_INSTALL="/Users/hyoban/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
# export GITHUB_TOKEN=$(cat ~/Documents/github.txt )
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 preview"
alias c="nr typecheck"
alias lint="nr lint"
alias lintf="nr lint:fix"
alias rei="release-it"
alias re="nr release"
alias f="nr format"
alias fc="nr format --check"
alias o='f(){ open -n -a "Google Chrome" --args --incognito "http://localhost:$@"; unset -f f; }; f'
alias od='open -n -a "Google Chrome" --args --incognito "http://localhost:5173"'
alias ll="ls -alh -D '%Y-%m-%dT%H:%M:%S'"
alias rlp="defaults write com.apple.dock ResetLaunchPad -bool true && killall Dock"
### Git
# brew install gh
# 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 --autostash'
alias gplu='git pull --rebase --autostash --set-upstream upstream main'
alias gplo='git pull --rebase --autostash --set-upstream origin main'
alias gcl='git clone'
alias gst='git stash'
alias grm='git rm'
alias gmv='git mv'
alias main='git checkout main'
alias dev='git checkout dev'
alias gco='git checkout'
alias gcob='git checkout -b'
alias gb='git branch'
alias gbd='git branch -d'
alias grb='git rebase'
alias grbom='git rebase origin/master'
alias grbc='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 gfrb='git fetch origin && git rebase origin/master'
alias gxn='git clean -dn'
alias gx='git clean -df'
alias gsha='git rev-parse HEAD | pbcopy'
alias clean='git clean -xdff'
# -------------------------------- #
# Directories
#
# I put
# `~/i` for my projects
# `~/f` for forks
# `~/r` for reproductions
# `~/w` for work
# -------------------------------- #
function i() {
cd ~/i/$1
}
function repros() {
cd ~/r/$1
}
function forks() {
cd ~/f/$1
}
function works() {
cd ~/w/$1
}
function pr() {
if [ $1 = "ls" ]; then
gh pr list
else
gh pr checkout $1
fi
}
function dir() {
mkdir $1 && cd $1
}
function clone() {
if [[ -z $2 ]] then
gh repo clone "$@" && cd "$(basename "$1" .git)"
else
gh repo clone "$@" && cd "$2"
fi
}
# Clone to ~/i and cd to it
function clonei() {
i && clone "$@" && code . && cd ~2
}
function cloner() {
repros && clone "$@" && code . && cd ~2
}
function clonef() {
forks && clone "$@" && code . && cd ~2
}
function clonew() {
works && clone "$@" && code . && cd ~2
}
function codei() {
i && code "$@" && cd -
}
function coder() {
repros && code "$@" && cd -
}
function codef() {
forks && code "$@" && cd -
}
function codew() {
works && code "$@" && cd -
}
{
// disable some built-in features
"breadcrumbs.enabled": false,
"editor.accessibilitySupport": "off",
"editor.bracketPairColorization.enabled": false,
"editor.guides.bracketPairs": "active",
"editor.minimap.enabled": false,
"editor.renderLineHighlight": "none",
"security.promptForLocalFileProtocolHandling": false,
"security.workspace.trust.enabled": false,
"window.commandCenter": false,
"window.restoreWindows": "none",
"workbench.layoutControl.enabled": false,
"workbench.startupEditor": "none",
"workbench.tips.enabled": false,
// git related
"diffEditor.ignoreTrimWhitespace": false,
"diffEditor.experimental.showMoves": true,
"git.autofetch": true,
"git.confirmSync": false,
"git.enableSmartCommit": true,
"gitlens.codeLens.enabled": false,
"gitlens.currentLine.enabled": false,
"gitlens.hovers.currentLine.over": "line",
"gitlens.hovers.enabled": false,
// animations
"editor.cursorBlinking": "smooth",
"editor.cursorSmoothCaretAnimation": "on",
"editor.smoothScrolling": true,
"workbench.list.smoothScrolling": true,
// appearance
"[markdown]": {
"editor.lineNumbers": "on"
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": ["comment"],
"settings": {
"fontStyle": "italic"
}
}
]
},
"editor.fontFamily": "Monolisa Variable",
"editor.fontSize": 15,
"editor.fontVariations": true,
"editor.lineHeight": 1.8,
"editor.lineNumbers": "off",
"files.simpleDialog.enable": true,
"terminal.integrated.fontSize": 15,
"window.title": "${activeEditorLong}${separator}${rootName}",
"workbench.activityBar.location": "top",
"workbench.editor.limit.enabled": true,
"workbench.editor.limit.perEditorGroup": true,
"workbench.editor.limit.value": 5,
"workbench.colorTheme": "GitHub Dark Default",
"window.autoDetectColorScheme": true,
"workbench.preferredLightColorTheme": "GitHub Light Default",
"workbench.preferredDarkColorTheme": "GitHub Dark Default",
"workbench.iconTheme": "file-icons",
"workbench.sideBar.location": "right",
"zenMode.fullScreen": false,
// others
"files.readonlyFromPermissions": true,
"files.readonlyInclude": {
"**/node_modules/**": true,
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
"**/yarn.lock": true
},
"search.exclude": {
"**/*.snap": true,
"**/*.svg": true,
"**/.git": true,
"**/.github": false,
"**/.nuxt": true,
"**/.output": true,
"**/.pnpm": true,
"**/.vscode": true,
"**/.yarn": true,
"**/assets": true,
"**/bower_components": true,
"**/dist/**": true,
"**/logs": true,
"**/node_modules": true,
"**/out/**": true,
"**/package-lock.json": true,
"**/pnpm-lock.yaml": true,
"**/public": true,
"**/temp": true,
"**/yarn.lock": true,
"**/CHANGELOG*": true,
"**/LICENSE*": true
},
// extensions
"cSpell.userWords": ["antfu", "hyoban", "typecheck"],
"cSpell.diagnosticLevel": "Hint",
"errorLens.enabledDiagnosticLevels": ["error", "warning", "hint", "info"],
"errorLens.exclude": [
"^\".*\": Unknown word\\.$",
"'.*' is defined",
"'.*' is declared",
"'.*' is assigned a value but never used"
],
"errorLens.fontStyleItalic": true,
"i18n-ally.displayLanguage": "en",
"iconify.inplace": false,
"rest-client.previewColumn": "current",
"tailwindCSS.colorDecorators": false,
"unocss.colorPreview": false,
"github.copilot.editor.enableCodeActions": false,
"github.copilot.enable": {
"*": true,
"plaintext": true,
"markdown": true,
"scminput": false
},
"markdownlint.config": {
"no-bare-urls": false,
"no-inline-html": false,
"fenced-code-language": false
},
"package-manager-enhancer.enablePackageJsonDependenciesCodeLens": false
}
# https://starship.rs/presets/no-nerd-font.html
[battery]
full_symbol = "• "
charging_symbol = "⇡ "
discharging_symbol = "⇣ "
unknown_symbol = "❓ "
empty_symbol = "❗ "
[erlang]
symbol = "ⓔ "
[nodejs]
symbol = "[⬢](bold green) "
[pulumi]
symbol = "🧊 "
[typst]
symbol = "t "
# https://stackoverflow.com/a/49398449/15548365
# code --list-extensions | xargs -L 1 echo code --install-extension
code --install-extension amodio.tsl-problem-matcher
code --install-extension antfu.goto-alias
code --install-extension antfu.iconify
code --install-extension antfu.slidev
code --install-extension antfu.unocss
code --install-extension astro-build.astro-vscode
code --install-extension biomejs.biome
code --install-extension bradlc.vscode-tailwindcss
code --install-extension connor4312.esbuild-problem-matchers
code --install-extension davidanson.vscode-markdownlint
code --install-extension dbaeumer.vscode-eslint
code --install-extension denoland.vscode-deno
code --install-extension dotjoshjohnson.xml
code --install-extension dprint.dprint
code --install-extension eamodio.gitlens
code --install-extension editorconfig.editorconfig
code --install-extension esbenp.prettier-vscode
code --install-extension file-icons.file-icons
code --install-extension github.copilot
code --install-extension github.copilot-chat
code --install-extension github.github-vscode-theme
code --install-extension github.vscode-github-actions
code --install-extension github.vscode-pull-request-github
code --install-extension humao.rest-client
code --install-extension hyoban.tailwindcss-classname-highlight
code --install-extension hyoban.xlog
code --install-extension johnsoncodehk.vscode-tsconfig-helper
code --install-extension lokalise.i18n-ally
code --install-extension mechatroner.rainbow-csv
code --install-extension ms-azuretools.vscode-docker
code --install-extension mushan.vscode-paste-image
code --install-extension mxsdev.typescript-explorer
code --install-extension naumovs.color-highlight
code --install-extension prisma.prisma
code --install-extension richie5um2.vscode-sort-json
code --install-extension streetsidesoftware.code-spell-checker
code --install-extension talhabalaj.actual-font-changer
code --install-extension tamasfe.even-better-toml
code --install-extension unifiedjs.vscode-mdx
code --install-extension usernamehw.errorlens
code --install-extension vitest.explorer
code --install-extension vue.volar
code --install-extension wayou.vscode-todo-highlight
code --install-extension yoavbls.pretty-ts-errors
code --install-extension yutengjing.package-manager-enhancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment