← กลับ

การตั้งค่า macOS สำหรับผู้ใช้ขั้นสูง

ผมตั้งค่า Mac ให้ใช้งานและสลับไปมาระหว่างแอปได้เร็วพอ ๆ กับ Linux โดยสิ่งหลัก ๆ ที่ใช้มีดังนี้:

เริ่มจากอันที่ง่ายที่สุด Rectangle เป็นแค่ตัวจัดการหน้าต่างของผม ผมแทบใช้แค่คีย์ลัด left_option + left_control + enter เพื่อขยายหน้าต่างเป็นเต็มจอและจัดกึ่งกลาง

หัวใจสำคัญของทั้งหมดนี้คือ อย่าใช้เดสก์ท็อปหรือโหมดเต็มจอที่มากับ macOS เด็ดขาด เพราะจะทำให้การสลับระหว่างแอปช้าลงมาก แค่ขยายแอปเป็นเต็มจอ แล้วสลับไปมาด้วย cmd + tab และคีย์ลัดสำหรับเปิดแอปใน Raycast

ส่วนสำคัญถัดไปคือ Karabiner Elements ผมใช้มันสร้าง hyper key บนปุ่ม caps lock โดยตั้งไว้ว่าแตะครั้งเดียวจะกด escape แต่ถ้ากดพร้อมปุ่มอื่นจะทำงานเป็น control + option + shift + command มันทรงพลังมากสำหรับการนำทางและทำงาน โดยเฉพาะเมื่อใช้ร่วมกับ Raycast

ผมตั้ง Raycast ไว้ที่ hyper + space (ซึ่งจริง ๆ คือ caps lock + space) จากนั้นใน Raycast ให้ค้นหา extensions แล้วค้นหาแอป ก็จะตั้งคีย์ลัดให้แอปนั้นได้ ของผมทั้งหมดเป็น hyper + ปุ่มอื่น ดูทั้งหมดได้ ที่นี่

คอนฟิกง่ายสุด ๆ

ตอนตั้งค่า Mac ผมปรับแต่ง tmux, Ghostty และ Cursor ไว้เยอะมาก ผมไม่เคยอ่านคอนฟิกของตัวไหนเลย แค่ทำคำสั่งเล็ก ๆ สำหรับ OpenCode แล้วให้ AI เขียนคอนฟิกให้ มันไม่ได้ซับซ้อน แต่ถ้าอยากดูของผมไว้เป็นข้อมูลอ้างอิง:

Ghostty

~/.opencode/command/ghostty.md

---
description: Help make changes to my terminal emulator
agent: build
---

Run "ghostty +show-config --default --docs" to see the full guide on how to configure my terminal emulator Ghostty. In this session I want you to help me get it configured. When I tell you to make a change, reference the docs on how to do it, and then write the changes to: "~/Library/Application Support/com.mitchellh.ghostty/config"

Cursor

~/.opencode/command/cursor.md

---
description: Help fine tune my Cursor keybindings
agent: build
---

My Cursor (VSCode) keybindings are located at: "~/Library/Application Support/Cursor/User/keybindings.json". In this session your job is to help me fine tune them.

tmux

~/.opencode/command/tmux.md

---
description: Help fine tune tmux config
agent: build
---

My tmux config is located at: ~/.tmux.conf Your job is to make the changes I describe to that config file. Every time you make a change, make sure to end by giving me the command I need to restart my current tmux instance and use the changes immediately

แค่วางไฟล์เหล่านี้ไว้ แล้วเปิด OpenCode จากไดเรกทอรีราก จากนั้นใช้ /tmux เพื่อปรับแต่งคอนฟิก tmux ได้เลย โดยไม่ต้องมานั่งตั้งค่าคอนฟิกอีกชุด