Skip to content

Instantly share code, notes, and snippets.

@Wxh16144
Last active January 3, 2023 07:54
Show Gist options
  • Save Wxh16144/742ba8845786c9e09001653ca6e5c651 to your computer and use it in GitHub Desktop.
Save Wxh16144/742ba8845786c9e09001653ca6e5c651 to your computer and use it in GitHub Desktop.
oh-my-zsh
[user]
name = wuxh
email = wxh1220@gmail.com
signingkey = wuxh
[core]
excludesfile = /Users/wuxh/.gitignore_global
ignorecase = true
# ref: https://stackoverflow.com/a/36427485/11302760
# ref: https://code.visualstudio.com/docs/editor/versioncontrol#_vs-code-as-git-editor
editor = code --disable-extensions --wait
# ref: https://code.visualstudio.com/docs/editor/versioncontrol#_vs-code-as-git-diff-tool
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --disable-extensions --wait --diff $LOCAL $REMOTE
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
co = checkout
cob = checkout -b
cor = checkout --orphan # 创建无历史记录的分支
coo = !git fetch && git checkout
br = branch
brd = branch -d
st = status
aa = add -A .
unstage = reset --soft HEAD^
cm = commit -m
amend = commit --amend --no-edit # 个人需求调整
fix = commit --fixup
undo = reset HEAD~1
rv = revert
cp = cherry-pick
pu = !git push origin `git branch --show-current`
fush = push -f
mg = merge --no-ff
rb = rebase
rbc = rebase --continue
rba = rebase --abort
rbs = rebase --skip
rom = !git fetch && git rebase -i origin/master --autosquash
save = stash push
pop = stash pop
apply = stash apply
rl = reflog
code = !code --disable-extensions
lg = log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
[commit]
gpgsign = true
template = /Users/wuxh/.stCommitMsg
[includeIf "gitdir:~/Code/CompanyProject/"]
path = ~/.gitconfig_work
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# 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"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
ZSH_THEME_RANDOM_CANDIDATES=(
"mgutz"
"mira"
"jreese"
"strug"
"gozilla"
"clean"
"refined"
"takashiyoshida"
)
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
zstyle ':omz:update' frequency 30 # auto-update every 30 days
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
HIST_STAMPS="yyyy/mm/dd"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
vscode
# docker
# docker-compose
# yarn # 使用 https://github.com/antfu/ni 代替
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-autosuggestions
# git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
fast-syntax-highlighting
# brew install autojump
autojump
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
source /Users/wuxh/.config/broot/launcher/bash/br
# https://askubuntu.com/a/473770
alias c="clear && printf '\e[3J'"
alias p="pwd"
alias e="exit"
alias cpwd="pwd | pbcopy && echo successfully"
# 工作目录
export WORKSPACE="$HOME/Code"
alias w="cd $WORKSPACE"
export COMPANY=$WORKSPACE/CompanyProject
alias com="cd $COMPANY"
export STUDY=$WORKSPACE/StudyProject
alias stu="cd $STUDY"
alias oss="cd $STUDY"
export MY=$WORKSPACE/SelfProject
alias my="cd $MY"
export PLAY=$WORKSPACE/Playground
alias play="cd $PLAY"
# 显示/隐藏 隐藏的文件
alias show="sh $ZSH_CUSTOM/custom_shell/show.sh"
alias hide="sh $ZSH_CUSTOM/custom_shell/hide.sh"
# -------------------------------- #
# Node Package Manager
# -------------------------------- #
# https://github.com/antfu/ni
alias i="ni"
# alias s="nr start"
function s() {
function has_script() {
[[ $(npm run | grep "^ $1$" | wc -l) -eq 1 ]]
}
if has_script start; then
nr start
elif has_script dev; then
nr dev
else
echo "No dev or start script found."
fi
}
alias dev="nr dev"
alias b="nr build"
alias t="nr test"
alias lint="nr lint"
alias lintf="nr lint --fix"
# -------------------------------- #
# Package registry Manage
# -------------------------------- #
function nrr() {
# na from https://github.com/antfu/ni
# 预设的 registry
declare -A registrys
registrys=(
[npm]="https://registry.npmjs.org/"
[yarn]="https://registry.yarnpkg.com/"
[tencent]="https://mirrors.cloud.tencent.com/npm/"
[cnpm]="https://r.cnpmjs.org/"
[taobao]="https://registry.npmmirror.com/"
[npmMirror]="https://skimdb.npmjs.com/registry/"
# [company]="https://packages.aliyun.com/616ff38165b9775dd591fcc9/npm/npm-registry/"
[self]="http://nas.wxhboy.cn:98/"
[selfIp]="http://192.168.31.10:98/"
)
set_registry(){
# 经常遇到安装依赖问题,索性就把所有的 registry 都设置一下
npm config set registry $1
yarn config set registry $1
echo "Set registry to $1"
}
# 如果没有参数, 则表示查看当前 registry,并且询问是否要重置为默认 registry [npm]
if [ $# -eq 0 ]; then
echo "Current registry: $(na config get registry)"
echo -n -e "Reset to default registry[npm]? [y/n] "
read agreeReset
if [ $agreeReset = "y" ]; then
set_registry ${registrys[npm]}
echo "Reset to default registry: ${registrys[npm]}"
fi
return
fi
# 判断输入的 registry 是否存在
if [ -z ${registrys[$1]} ]; then
echo "Registry not found: $1"
echo "Available registrys:"
for key in ${(@k)registrys}; do
echo " $key: ${registrys[$key]}"
done
return
fi
set_registry ${registrys[$1]}
echo "Set registry to: ${registrys[$1]}"
}
# -------------------------------- #
# Command Line Tools
# -------------------------------- #
function treem(){
tree -I 'node_modules|cache|test_*' -L 3 $@
}
# 列出当前目录下的所有 node_modules
function lsnm(){
find . -name "node_modules" -type d -prune
}
# 删除当前目录下的所有 node_modules
function rmnm(){
local nm=$(lsnm)
if [[ $1 == "-a" ]]; then
echo $nm | xargs -n 1 rm -rf
echo "All node_modules have been removed."
else
echo $nm | xargs -n 1 -p rm -rf
fi
}
# -------------------------------- #
# Directories
#
# `~/Code/SelfProject` for my projects
# `~/Code/StudyProject` for OSS projects
# -------------------------------- #
function hidedir(){
chflags hidden $1
}
function nohidedir(){
chflags nohidden $1
}
function dir() {
mkdir -p $1 && cd $1
}
function clone() {
if [[ -z $2 ]] then
git clone --recurse-submodules "$@" && cd "$(basename "$1" .git)"
else
git clone --recurse-submodules "$@" && cd "$2"
fi
}
function clonemy() {
my && clone "$@" && code --disable-extensions .
}
function cloneoss() {
oss # cd directory
clone "$@"
local repo=$1
if [[ $repo =~ "git@github.com" ]]; then
local repoName=$(basename "$repo" .git)
# setting upstream
git remote add upstream $repo
git remote set-url origin "git@github.com:Wxh16144/$repoName.git"
fi
code --disable-extensions .
}
# clone oss project https://github.com/react-component/{repoName}
function cloneossrc() {
local repo=$1
local repoName=$(basename "$repo" .git)
cloneoss "$repo" "react-component/$repoName"
}
# -------------------------------- #
# Git shortcut
# -------------------------------- #
# 记录当前分支,切换到指定分支(默认 master)拉取更新后,再切换回来
function gbsw() {
local defaultTarget="master"
if [[ -n $(git status --porcelain) ]] then
echo "current workspace is dirty, please save first"
git status -sb
return 1
fi
local branch=$(git rev-parse --abbrev-ref HEAD)
local target=${1:-$defaultTarget}
git checkout $target
git pull
git checkout $branch
echo -n -e "Do you want to rebase? [y/N]"
read isRebase
if [[ $isRebase == "y" ]] then
git rebase $target
fi
}
# 快速修复某一条记录(默认上一条),并进行 rebase squash 操作
function gfix() {
if [[ -z $(git diff --cached --name-only) ]] then
echo "no staged files"
git status -sb
return 1
fi
local hash=$1
if [[ -z $hash ]] then
hash=$(git log -1 --pretty=%H)
fi
git commit --fixup $hash
# --autosquash 模式不支持非交互式 reabse, 需要通过环境变量控制
# https://stackoverflow.com/questions/29094595/git-interactive-rebase-without-opening-the-editor#answer-29094904
GIT_SEQUENCE_EDITOR=: git rebase -i $hash^ --autosquash
}
# 使用一个分支备份当前 git 修改
function gbp() {
local new_branch="$(whoami)/$(date +%Y/%m/%d-%H_%M_%S)"
# 工作区是干净的
if [[ -z $(git status --porcelain) ]] then
git branch $new_branch
echo "The current workspace is clean, and a new branch:${new_branch} is created"
return 1
fi
local branch=$(git rev-parse --abbrev-ref HEAD)
local hash=$(git rev-parse --short HEAD)
local staged=$(git diff --cached --name-only)
# local unstaged=$(git diff --name-only)
git add -A
git commit --no-verify --no-gpg-sign -m "backup: WIP ${branch}[${hash}] (--skip-ci)"
git checkout -b $new_branch
git checkout $branch
git reset --mixed HEAD^
if [[ -n $staged ]] then
git add $staged
fi
}
# 批量删除分支, 支持 grep 参数,输入 y 确定删除
function gbdel() {
local branches=$(git branch --all | awk '{print $1}')
local ignore_branches=$(echo "$branches" | grep -v -E '^(master|dev|test)$|^dev-|^remotes|\*')
echo "$ignore_branches" | grep ${1-.} | xargs -n 1 -p git branch -D
}
# ---------- start ----------
# ref: https://stackoverflow.com/questions/38475154/set-title-and-badge-text-in-iterm
# ref: https://iterm2.com/documentation-shell-integration.html
# ref: https://iterm2.com/3.0/documentation-badges.html
# This will set your window title
export PROMPT_COMMAND='echo -sne "\033]0;${PWD##*/}\007"'
# source ~/.iterm2_shell_integration.`basename $SHELL`
# This creates the var currentDir to use later on
function iterm2_print_user_vars() {
iterm2_set_user_var currentDir "${PWD##*/}"
}
# ---------- end ----------
{
"Badge Text" : "\\(user.currentDir)",
"Working Directory" : "\/Users\/wuxh\/Code",
"Prompt Before Closing 2" : false,
"Selected Text Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Rows" : 25,
"Ansi 11 Color" : {
"Green Component" : 1,
"Blue Component" : 0.3333333432674408,
"Red Component" : 1
},
"Use Italic Font" : true,
"Foreground Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Use Custom Window Title" : false,
"Right Option Key Sends" : 0,
"Character Encoding" : 4,
"Selection Color" : {
"Green Component" : 0.8353000283241272,
"Blue Component" : 1,
"Red Component" : 0.70980000495910645
},
"Blend" : 1,
"Show Mark Indicators" : false,
"Mouse Reporting" : true,
"Ansi 4 Color" : {
"Green Component" : 0,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0
},
"Non-ASCII Anti Aliased" : true,
"Sync Title" : false,
"Badge Font" : "PTMono-Bold",
"Disable Window Resizing" : true,
"Description" : "Default",
"Close Sessions On End" : true,
"Jobs to Ignore" : [
"rlogin",
"ssh",
"slogin",
"telnet"
],
"Scrollback Lines" : 1000,
"Hide After Opening" : false,
"Flashing Bell" : false,
"Cursor Guide Color" : {
"Red Component" : 0.70214027166366577,
"Color Space" : "sRGB",
"Blue Component" : 1,
"Alpha Component" : 0.25,
"Green Component" : 0.92681378126144409
},
"BM Growl" : true,
"Ansi 3 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0,
"Red Component" : 0.73333334922790527
},
"Icon" : 0,
"Use Non-ASCII Font" : true,
"Use Custom Tab Title" : false,
"Shortcut" : "",
"Link Color" : {
"Red Component" : 0,
"Color Space" : "sRGB",
"Blue Component" : 0.73422712087631226,
"Alpha Component" : 1,
"Green Component" : 0.35915297269821167
},
"Background Image Location" : "\/Users\/wuxh\/Documents\/Pictures\/wallpaper\/wallhaven-z8gz5v.png",
"_Background Image Location": "https://w.wallhaven.cc/full/z8/wallhaven-z8gz5v.png",
"Bold Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Unlimited Scrollback" : false,
"Allow Title Setting" : false,
"Custom Command" : "No",
"Title Components" : 130,
"Keyboard Map" : {
"0xf700-0x260000" : {
"Action" : 10,
"Text" : "[1;6A"
},
"0x37-0x40000" : {
"Action" : 11,
"Text" : "0x1f"
},
"0x32-0x40000" : {
"Action" : 11,
"Text" : "0x00"
},
"0xf709-0x20000" : {
"Action" : 10,
"Text" : "[17;2~"
},
"0xf70c-0x20000" : {
"Action" : 10,
"Text" : "[20;2~"
},
"0xf729-0x20000" : {
"Action" : 10,
"Text" : "[1;2H"
},
"0xf72b-0x40000" : {
"Action" : 10,
"Text" : "[1;5F"
},
"0xf705-0x20000" : {
"Action" : 10,
"Text" : "[1;2Q"
},
"0xf703-0x260000" : {
"Action" : 10,
"Text" : "[1;6C"
},
"0xf700-0x220000" : {
"Action" : 10,
"Text" : "[1;2A"
},
"0xf701-0x280000" : {
"Action" : 11,
"Text" : "0x1b 0x1b 0x5b 0x42"
},
"0x38-0x40000" : {
"Action" : 11,
"Text" : "0x7f"
},
"0x33-0x40000" : {
"Action" : 11,
"Text" : "0x1b"
},
"0xf703-0x220000" : {
"Action" : 10,
"Text" : "[1;2C"
},
"0xf701-0x240000" : {
"Action" : 10,
"Text" : "[1;5B"
},
"0xf70d-0x20000" : {
"Action" : 10,
"Text" : "[21;2~"
},
"0xf702-0x260000" : {
"Action" : 10,
"Text" : "[1;6D"
},
"0xf729-0x40000" : {
"Action" : 10,
"Text" : "[1;5H"
},
"0xf706-0x20000" : {
"Action" : 10,
"Text" : "[1;2R"
},
"0x34-0x40000" : {
"Action" : 11,
"Text" : "0x1c"
},
"0xf700-0x280000" : {
"Action" : 11,
"Text" : "0x1b 0x1b 0x5b 0x41"
},
"0x2d-0x40000" : {
"Action" : 11,
"Text" : "0x1f"
},
"0xf70e-0x20000" : {
"Action" : 10,
"Text" : "[23;2~"
},
"0xf702-0x220000" : {
"Action" : 10,
"Text" : "[1;2D"
},
"0xf703-0x280000" : {
"Action" : 11,
"Text" : "0x1b 0x1b 0x5b 0x43"
},
"0xf700-0x240000" : {
"Action" : 10,
"Text" : "[1;5A"
},
"0xf707-0x20000" : {
"Action" : 10,
"Text" : "[1;2S"
},
"0xf70a-0x20000" : {
"Action" : 10,
"Text" : "[18;2~"
},
"0x35-0x40000" : {
"Action" : 11,
"Text" : "0x1d"
},
"0xf70f-0x20000" : {
"Action" : 10,
"Text" : "[24;2~"
},
"0xf703-0x240000" : {
"Action" : 10,
"Text" : "[1;5C"
},
"0xf701-0x260000" : {
"Action" : 10,
"Text" : "[1;6B"
},
"0xf702-0x280000" : {
"Action" : 11,
"Text" : "0x1b 0x1b 0x5b 0x44"
},
"0xf72b-0x20000" : {
"Action" : 10,
"Text" : "[1;2F"
},
"0x36-0x40000" : {
"Action" : 11,
"Text" : "0x1e"
},
"0xf708-0x20000" : {
"Action" : 10,
"Text" : "[15;2~"
},
"0xf701-0x220000" : {
"Action" : 10,
"Text" : "[1;2B"
},
"0xf70b-0x20000" : {
"Action" : 10,
"Text" : "[19;2~"
},
"0xf702-0x240000" : {
"Action" : 10,
"Text" : "[1;5D"
},
"0xf704-0x20000" : {
"Action" : 10,
"Text" : "[1;2P"
}
},
"Ansi 14 Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 0.3333333432674408
},
"Ansi 2 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0,
"Red Component" : 0
},
"Send Code When Idle" : false,
"ASCII Anti Aliased" : true,
"Tags" : [
],
"Ansi 9 Color" : {
"Green Component" : 0.3333333432674408,
"Blue Component" : 0.3333333432674408,
"Red Component" : 1
},
"Badge Right Margin" : 10,
"Use Bold Font" : true,
"Silence Bell" : false,
"Ansi 12 Color" : {
"Green Component" : 0.3333333432674408,
"Blue Component" : 1,
"Red Component" : 0.3333333432674408
},
"Window Type" : 0,
"Allow Title Reporting" : true,
"Use Bright Bold" : true,
"Cursor Text Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Default Bookmark" : "No",
"Cursor Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Ansi 1 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0.73333334922790527
},
"Name" : "mySelf",
"Blinking Cursor" : false,
"Guid" : "AB43497F-50E2-4F9B-B321-5C02AD1E01C4",
"Badge Max Width" : 0.94999999999999996,
"Ansi 8 Color" : {
"Green Component" : 0.3333333432674408,
"Blue Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408
},
"Ansi 10 Color" : {
"Green Component" : 1,
"Blue Component" : 0.3333333432674408,
"Red Component" : 0.3333333432674408
},
"Idle Code" : 0,
"Badge Color" : {
"Red Component" : 0.78039216995239258,
"Color Space" : "sRGB",
"Blue Component" : 0.80000001192092896,
"Alpha Component" : 0.25882352941176473,
"Green Component" : 0.92941176891326904
},
"Ambiguous Double Width" : false,
"Blur Radius" : 5.262209109042554,
"Badge Max Height" : 0.29999999999999999,
"Background Image Mode" : 0,
"Cursor Type" : 0,
"Ansi 0 Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Blur" : true,
"Normal Font" : "PTMono-Regular 16",
"Vertical Spacing" : 1,
"Ansi 7 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
},
"Command" : "",
"Terminal Type" : "xterm-256color",
"Horizontal Spacing" : 1,
"Option Key Sends" : 0,
"Only The Default BG Color Uses Transparency" : true,
"Blink Allowed" : false,
"Minimum Contrast" : 0,
"Ansi 15 Color" : {
"Green Component" : 1,
"Blue Component" : 1,
"Red Component" : 1
},
"Open Toolbelt" : false,
"Unicode Version" : 9,
"Ansi 6 Color" : {
"Green Component" : 0.73333334922790527,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0
},
"Badge Top Margin" : 260,
"Transparency" : 0.079645944148936484,
"Background Color" : {
"Green Component" : 0,
"Blue Component" : 0,
"Red Component" : 0
},
"Initial Text" : "",
"Screen" : -1,
"Custom Tab Title" : "",
"Non Ascii Font" : "FiraCodeRoman-Regular 14",
"Ansi 13 Color" : {
"Green Component" : 0.3333333432674408,
"Blue Component" : 1,
"Red Component" : 1
},
"Columns" : 80,
"Unicode Normalization" : 0,
"Visual Bell" : true,
"Custom Directory" : "Yes",
"Thin Strokes" : 4,
"Ansi 5 Color" : {
"Green Component" : 0,
"Blue Component" : 0.73333334922790527,
"Red Component" : 0.73333334922790527
}
}
# https://github.com/nvm-sh/nvm#manual-install
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
# https://github.com/nvm-sh/nvm#deeper-shell-integration
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
# fix husky hook
# ref: https://github.com/typicode/husky/issues/390#issuecomment-762213421
echo "export PATH=\"$(dirname $(which node)):\$PATH\"" > ~/.huskyrc
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
# https://github.com/nvm-sh/nvm#use-a-mirror-of-node-binaries
# https://mirrors.ustc.edu.cn/help/node.html#nvm-node-js
export NVM_NODEJS_ORG_MIRROR=https://mirrors.ustc.edu.cn/node/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment