推荐软件
vscode、chrome、ClashX、Alfred 4、iHosts、Beyond Compare、Navicat Premium、Cyberduck、Charles
显示隐藏文件
// 此命令显示隐藏文件
$ defaults write com.apple.finder AppleShowAllFiles -bool true
// 此命令关闭显示隐藏文
$ defaults write com.apple.finder AppleShowAllFiles -bool false
// 命令运行之后需要重新加载Finder:快捷键option+command+esc,选中Finder,重新启动即可
安装homebrew
直接使用官方的方式安装,在国内会贼慢,推荐使用下面的方法。
$ cd ~
// 下载安装脚本
$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
// 替换官方镜像源为清华的镜像源
$ vim brew_install
// #HOMEBREW_CORE_TAP = "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core".freeze
// #BREW_REPO = "https://github.com/Homebrew/brew".freeze
// 将上面的两个镜像源替换为下面的镜像源,如果brew_install文件没有HOMEBREW_CORE_TAP和BREW_REPO,那就直接添加在文末
// HOMEBREW_CORE_TAP = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze
// BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
// 安装
$ ruby ./brew_install
// 长期替换源
// 如果你使用 bash:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zprofile
source ~/.zprofile
// 如果你使用 zsh:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
安装node
node官网,测试是否成功
安装cnpm
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
测试是否成功
安装nrm
安装完npm和cnpm之后可以安装nrm来切换源。
$ sudo cnpm i nrm -g
// 使用方法
$ nrm ls // 查看源
$ nrm test cnpm // 测试源的下载速度
$ nrm use taobao // 切换源
创建ssh key、配置git
// 设置username和email
$ git config --global user.name "zhangxiaozheng"
$ git config --global user.email "617078920@qq.com"
// 通过终端命令创建ssh key,然后一路回车
$ ssh-keygen -t rsa -C "617078920@qq.com"
// 查看ssh,并且复制到github等网站
$ cat .ssh/id_rsa.pub
安装oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
更改zsh配置,主题样式网站
$ vim ~/.zshrc
// 推荐主题
ZSH_THEME="awesomepanda"
// 配置别名,方便使用 比如 code .
alias history="fc -il 1"
alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
alias gf='git fetch'
alias gpu='git pull'
alias gpuo='git pull origin'
alias gpuom='git pull origin master'
alias gpuu='git pull upstream'
alias gpuum='git pull upstream master'
alias gps='git push'
alias gpso='git push origin'
alias gpsom='git push origin master'
alias gpsu='git push upstream'
alias gpsum='git push upstream master'
alias gco='git checkout'
alias gb='git branch'
alias gt='git tag'
alias gl='git log'
alias gs='git status'
alias ga='git add'
alias gci='git commit -m'
alias gm='git merge'
alias gd='git diff'
alias grb='git rebase -i'
alias gqa='git fetch upstream; git reset --hard upstream/qa'
alias gpro='git fetch upstream; git reset --hard upstream/production'
配置vscode
settings sync 信息
{
"window.zoomLevel": 0,
"window.newWindowDimensions": "maximized",
"editor.fontFamily": "Fira Code",
"editor.renderIndentGuides": true,
"editor.tabSize": 2,
"editor.fontSize": 14,
"editor.tabCompletion": "on",
"editor.mouseWheelZoom": true,
"editor.renderControlCharacters": true,
"editor.formatOnType": true,
// 保存时格式化
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.wordSeparators": "`~!@#$%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.autoClosingBrackets": "always",
"editor.smoothScrolling": true,
"editor.minimap.enabled": false,
"editor.wordWrapColumn": 160,
"editor.suggestSelection": "first",
// "editor.defaultFormatter": "esbenp.prettier-vscode",
"git.enabled": true,
"scss.validate": true,
"extensions.ignoreRecommendations": true,
"[markdown]": {
"editor.quickSuggestions": true
},
"typescript.updateImportsOnFileMove.enabled": "always",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"git.enableSmartCommit": true,
"git.autofetch": true,
"git.confirmSync": false,
"breadcrumbs.enabled": true,
"breadcrumbs.filePath": "on",
"files.exclude": {
"**/__init__.py": true,
"**/.git/**": true,
"**/.vscode/**": true,
"**/*.pyc": true,
"**/*hot-update.json": true,
"**/node_modules/**": true,
"**/venv/**": true
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
},
"javascript.preferences.quoteStyle": "single",
"javascript.updateImportsOnFileMove.enabled": "never",
// "javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"javascript.implicitProjectConfig.experimentalDecorators": true,
"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"html.format.wrapAttributes": "preserve-aligned",
"html.format.wrapLineLength": 160,
"workbench.colorTheme": "One Dark Pro",
"workbench.activityBar.visible": true,
"workbench.iconTheme": "vscode-icons",
"workbench.startupEditor": "newUntitledFile",
"files.associations": {
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},
"emmet.includeLanguages": {
"wxml": "html"
},
"terminal.integrated.rendererType": "dom",
"terminal.integrated.shell.osx": "zsh",
"vsicons.dontShowNewVersionMessage": true,
"prettier.singleQuote": true,
"beautify.language": {
"js": {
"type": ["javascript", "json"],
"filename": [".jshintrc", ".jsbeautify"]
},
"css": ["css", "scss"],
"html": ["htm", "vue", "html"]
},
"vetur.validation.template": false,
// "vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"prettier": {
// 不加分号
"semi": true,
// 用单引号
"singleQuote": true,
// 禁止随时添加逗号
"trailingComma": ""
},
"js-beautify-html": {
"wrap_attributes": "force-expand-multiline"
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
}
}