Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Essential Mac Setup, VS Code Shortcuts, and Development Plugins

Tech 1

Mac Hardware and Configuration

GPU and CPU are integrated in to the M1 chip.

Sleep vs. Shutdown

For M1/M2 Macs, closing the lid to sleep 1-2 times weekly is sufficient; frequent shutdowns are unnecessary due to improved architecture. On Windows, disable "Fast Startup" and set timed hibernation to prevent memory aging.

Disk Space Management

Use Mac-specific cleaners like https://lemon.qq.com/ when disk space is full.

Installation

Package Types

  • Apple Silicon Mac (e.g., M1, M2): Use arm64.dmg.
  • Intel Mac: Use dmg.

Developer Verification Issues

If an app shows "cannot verify developer," use Spotlight: press Option + Cmd + Space to open the search box.

Input Methods

Switching Input Methods

  • Press fn to cycle through the input method list.
  • Press Shift to toggle between default Chinese/English.

Caps Lock

  • Hold Shift for temporary uppercase.
  • Long-press the Caps Lock key (中/英) to lock uppercase.

Special Characters

  • Backtick (`): Located left of number 1 in English input mode.
  • Shift + Tab: Used in terminal.

Touch ID and Lock Screen

Set up Touch ID in System Preferences for unlocking. Lock the screen with Ctrl + Cmd + Q or the power button (supports fingerprint recording).

App Management

Access apps via Finder > Applications. For downloads with out internet access, search directly on GitHub.

Host Switching and Hosts File

Use tools like SwitchHosts to switch hosts. Modify the hosts file to redirect specific websites.

Principle: Local Priority

When accessing a domain (e.g., www.bilibili.com), resolution order is:

  1. Browser/system cache.
  2. Local hosts file.
  3. Remote DNS servers.

Pointing a domain to 127.0.0.1 (loopback address) blocks access by redirecting requests to your own computer, preventing external DNS queries.

Editing Hosts File

  • Windows: Run Notepad as administrator, open C:\Windows\System32\drivers\etc\hosts, add entries (e.g., 1x.x.x.x xxxxx.corp.com), and save.
  • macOS/Linux: Use sudo vi /etc/hosts in terminal, press i to edit, add entries, press Esc, then :wq to save.
  • Verification: Run ping xxx.corp.com in terminal; if it returns 1x.xx.xx.xx, it's successful.

Network Configuration

Viewing IP Address

  • Terminal: Use ipconfig getifaddr en0 for Wi-Fi or ipconfig getifaddr en1 for Ethernet.
  • System Settings: Go to Wi-Fi > Details > TCP/IP > IP Address.

Static IP Setup

  1. Disable VPNs, proxies, or security software.
  2. Enter desired static IP in network settings.
  3. Set DNS (e.g., Google DNS: 8.8.8.8, 8.8.4.4).
  4. If connection drops, clear ARP cache with sudo arp -a -d and restart network with sudo ifconfig en0 down && sudo ifconfig en0 up.

Ports and Services

Ports identify programs/services (e.g., HTTP uses port 80, development servers use 8080). Use lsof -i :port_number to check port status.

Function Keys and Developer Mode

Hold fn to use F1-F12 keys. For Electron developer mode, press Shift + Ctrl + Cmd + M (or Alt on Windows).

Post-Update Issues

If text appears garbled after a macOS update:

  • Temporary: Clear cache or restart apps.
  • Persistent: Check encoding or install missing fonts.

File Operations

Renaming

  • Windows: Press F2.
  • macOS: Press Enter.

Copy and Delete

  • Copy: Cmd + D.
  • Delete: Ctrl + D (Windows) or Ctrl + Delete (macOS).

Finder Shortcuts

  • Cmd + Shift + G: Open any folder.
  • Cmd + F: Search non-hidden files.
  • Cmd + Shift + .: Show hidden files.
  • Cmd + ↑: Go up one directory.
  • Drag folders to Favorites for quick access.

Dual Monitor Setup

Drag the white menu bar to switch primary/secondary screens. To keep Dock on one screen, move the pointer to the bottom of the desired screen and wait.

Trackpad Gestures

  • Right-click: Two-finger tap.
  • Drag between screens: Tap trackpad or swipe up with two fingers.
  • Zoom: Two-finger pinch.
  • Launchpad/Desktop: Three-fingeer + thumb swipe.
  • App switching: Three-finger left/right swipe.
  • Show/hide apps: Three-finger up/down swipe.

System Monitoring

Activity Monitor/Task Manager

  • Windows: Ctrl + Shift + Esc.
  • macOS: Cmd + Option + Esc or search via Cmd + Space.

App Management

  • Close app: Cmd + Q.
  • Force quit: Cmd + Option + Esc.
  • Switch apps: Cmd + Tab (hold to cycle).

Emoji Picker

Press Ctrl + Cmd + Space to open the emoji picker.

Screenshots

  • Full screen: Cmd + Shift + 3 (includes external displays).
  • Selection: Cmd + Shift + 4 (click to start) or Shift + Cmd + 5 (drag box).
  • To clipboard: Add Ctrl (e.g., Cmd + Ctrl + Shift + 3 for primary display only).

Command Line

  • Terminate process: Ctrl + C (restart Webpack, not Vite).
  • Cursor movement: Ctrl + A (start), Ctrl + E (end), Ctrl + W (delete previous word).

Browser Shortcuts

  • New tab: Cmd + T.
  • New window: Cmd + N.
  • Incognito: Shift + Cmd + N.
  • Close tab/window: Cmd + W.
  • Developer tools: Cmd + Option + I.
  • Hard refresh: Cmd + R (bypass cache).
  • Normal reload: Cmd + Shift + R (use cache).

VS Code Shortcuts

Navigation

  • Command palette: Cmd + Shift + P.
  • File search: Cmd + P.
  • Global search: Cmd + Shift + F.
  • Go to line start/end: Cmd + Left/Right Arrow.

Editing

  • Cut/Copy/Paste: Cmd + X/C/V.
  • Undo/Redo: Cmd + Z / Cmd + Shift + Z.
  • Indent: Select lines and press Tab (right) or Shift + Tab (left).
  • Comment: Cmd + /.
  • Format: Shift + Option + F (requires plugin).

Selection and Cursors

  • Select word: Cmd + D (then Cmd + F to find).
  • Multiple selections: Hold Option and click, or Option + Shift and drag.
  • Delete left of cursor: Cmd + Delete.
  • Delete line: Cmd + Shift + K.

Terminal in VS Code

  • Split terminal: Use split icon.
  • Kill process: Cmd + Backspace.

VS Code Plugins

  • Auto Save: Saves on focus loss.
  • Continue AI: AI code assistant with shortcuts like Cmd + L (explain code), Tab (autocomplete), Cmd + I (refactor).
  • Prettier: Code formatter.
  • ESLint: Linting tool.
  • Chinese Language Pack: UI localization.
  • Git History: View git logs.
  • Vetur/Vue-Official: Vue syntax support.
  • Volar: Vue code hints.

iTerm and Terminal Commands

  • Clear screen: clear.
  • Find command location: whereis command_name.
  • Check version: command_name -v.
  • Install globally if not found: sudo npm i @package_name -g.
  • User-installed executables: Located in bin directory.

Peripheral Issues

  • Wired mouse: Use a Type-C to USB adapter; restart if not working.
  • External display not detected: Hold power button or check/reconnect cables.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.