[Mac] Front-end environment setup

55 阅读1分钟

Visual Studio Code

Settings sync (if required)

  • Login account: Login to the same account as the old device

  • Turn on the synchronization switch

  • Select synced content

Iterm2

Install Oh-My-Zsh

sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

Plugins

Zsh-autosuggestions

Used for command auto-completion, providing suggestions for input commands based on historical records and completion status.

git clone https://github.com/zsh-users/zsh-autosuggestions.git  ~/.oh-my-zsh/plugins/zsh-autosuggestions

Zsh-syntax-highlighting

Used for syntax highlighting.

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git  ~/.oh-my-zsh/plugins/zsh-syntax-highlighting

Execute the above two commands to download the plugin. After the download is complete, you need to configure it in .zshrc

vim ~/.zshrc

Open the.zshrc configuration file

Find the configuration of the plugins inside, fill in the two downloaded plugins in the parentheses, and separate the plugins directly with spaces

Generally, if we have downloaded git before, there will already be git in the parentheses, just add it after it

plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

Configure git alias

Open and edit zshrc

vi ~/.zshrc

Add content to the file in the following format

Note: There cannot be spaces before and after =, otherwise an error will be reported.

alias 命令别名='原命令'

Below are my commonly used aliases, for reference only

alias ge="git clone"
alias ga="git add ."
alias gc="git commit -m"
alias gp="git push"
alias gl="git pull"
alias go="git checkout"
alias gb="git branch"

Save and exit, execute the following command to make the previous configuration take effect

source ~/.zshrc

Change default font size

  • ITerm2 - Settings - Profiles - Text - Font

Change default path

Open and edit zshrc

vi ~/.zshrc

Change default path

cd [path]

NVM

  • Install

    • curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
      
  • Reload the configuration file with the source command

    • source ~/.zshrc
      
  • Verification

    • nvm -v
      

Code

  • Function: Use code [path] in Command Line to open the project through vscode
  • Install:Open Command Palette via ⌘ ⇧ P and type shell command to find the shell command

Node

  • Install via nvm
nvm install 14.19.1
nvm use 14.19.1