date: 2018-8-30 13:15:52
title: 我的開發(fā)環(huán)境
zen
- 搜索: 好記性不如會搜索
- 模糊匹配: 幾乎所有搜索的地方都支持模糊匹配, 只要順序正確就可以搜索到
- 工具化: 在重復執(zhí)行不出錯上, 機器絕對可以輕蔑地說「愚蠢的人類」, 我通常會回應「所以你是機器」
- 自動保存: 都 9102 了, 還不用自動保存
- vim: learn once, use everywhere
- 人生苦短, 我用 mac
- 高效, 是一種癮
mark
- 如果使用 docker, 推薦 16g+
- 觸控板
- 使用輕點取代按下: 設置-觸控板-輕點來點按
- 三指拖拽: 設置-輔助-鼠標和觸控板-觸控板選項
- 快捷鍵
- touchbar + fn
- 軟件
- 搜狗輸入法: 英文輸入 語音輸入
- Chrome
- 推展推薦: vimium
- 其他
- extension
- 谷歌訪問助手(http://www.ggfwzs.com/)
- 打開多線程下載: chrome://flags -> 搜索 download
- password 需要配合使用 iCloud
- extension
- alfred(效率神器): https://xclient.info/s/alfred.html
- 設置快捷鍵, 替換 spotlight: 設置-快捷鍵-spotlight-取消所有; Alfred設置快捷鍵為 cmd+空格
- 切換應用
- 打開網(wǎng)頁收藏夾: 設置-feature-網(wǎng)頁收藏夾
- workflow: yd(有道翻譯) 計算器 自定義搜索(bm 百度地圖)
- things: 雙手不離開鍵盤完成 todo list 管理
- nimble commander: 類似 total commander 的文件管理工具
- vscode: https://code.visualstudio.com/docs/?dv=osx
- 快捷鍵
- Cmd-S-p: 打開 command 面板
- 添加 code 命令到 PATH 中, 方便打開文件: command 面板 -> 輸入 path
- 自動保存: command 面板 -> autosave
- 添加 vim: command 面板 -> keymaps -> vim
- 快捷鍵
- sizeup: 窗口管理工具
- 只保留常用: 窗口調整到左右 / 窗口到不同顯示器 / 窗口居中或最大化
- jietu 截圖工具: https://jietu.qq.com/
- 配置快捷鍵, 只保留截圖快捷鍵, 關閉其他應用(微信/qq/企業(yè)微信/釘釘)的截圖快捷鍵
- homebrew: mac 包管理工具
- 常用工具: git curl tree
- fish: 超好用的shell
- fish_config(~/.config/fish/fish_config)
- 其他工具
- ag: 高效內容查找, 比 grep/awk 更快的遞歸搜索文檔
- htop: 代替 top
- jq: 格式化顯示 json
- brew cask 常用工具: iterm2 google-chrome firefox vscode
- iterm2 + fishshell
- git 狀態(tài)
- 代碼自動補全
- 為重復工作添加小腳本
- github 客戶端: https://desktop.github.com/
- 方便查看修改 -> 寫完代碼一定要自己 review, 自己自測
- docker - 搞定開發(fā)環(huán)境
- docker desktop + aliyun下載文件 + docker 中文網(wǎng)源
- docker desktop
- docker-compose
- vscode - 文本編輯
- phpstorm - IDE
- 提示
- 補全
- 重構
- datagrip - 數(shù)據(jù)庫管理工具
- 自動補全
- 快速切連接
- 快速打開表
- 快速查看DDL
- charles 視頻教程
- 無法抓包 -> 白名單/代理沖突
- 無法抓localhost: https://www.charlesproxy.com/documentation/faqs/localhost-traffic-doesnt-appear-in-charles/
- 迅雷
- imageopti 無損優(yōu)化圖片
- picgo + 七牛云: 圖片上傳工具
# allow app form anywhere
sudo spctl --master-disable
# SIP(system integrity protection, rootless)
csrutil disable
# 使用簡單密碼
pwpolicy -clearaccountpolicies
passwd # 修改密碼
# 刪除默認輸入法
cd ~/Library/Preferences
cp com.apple.HIToolbox.plist com.apple.HIToolbox.plist.bak
sudo open com.apple.HIToolbox.plist # 關閉SIP -> 切換到默認輸入法, 才能保存 -> 安裝xcode, 也可以 xed com.apple.HIToolbox.plist -> 重啟
# 七牛圖片高級處理: https://developer.qiniu.com/dora/manual/1270/the-advanced-treatment-of-images-imagemogr2
?imageMogr2/auto-orient/thumbnail/500x500 # 自動旋轉; 等比限寬+高縮放
?imageMogr2/rotate/-90 # 旋轉
alfred
alfred的確是神器, 需要好好提提:
- 切應用: 常用應用可以「調教」到輸入一個字母解決
- 搜索 文件
- 搜索 chrome 書簽
- 設置 百度/百度地圖 搜索
- 設置 微云 同步配置
Alfred workflow
workflow - gtihub: gh > help
查看幫助
iterm2
mouseless copy C-f-tab
Autocomplete C-;
Paste History C-S-h
Full Screen C-enter
Window Arrangements: 保存常用TAB布局
Shell Integration/Utilities https://iterm2.com/documentation-shell-integration.html
Password Manager
show timestamp
open quickly
find cursor C-/
iterm2 粘貼時有多余字符 0~ 1~: printf '\e[?2004l'
copy mode: cmd-S-c(進入) -> C-v(選中模式) jkhl(移動) y(復制)
使用ubuntu主題: Preferences(cmd+,)-Profiles-default-colors-(Color Presets...)下拉中選擇ubuntu
可以點擊Visit Online Gallery下載顏色主題
reference
- 還在用 Win?教你從零把 Mac 打造成開發(fā)利器
- mac 按鍵標識
- mac 軟件下載
- mac 找到快捷鍵
- mac 常用快捷鍵: https://support.apple.com/zh-cn/HT201236
- 外接顯示器: http://tieba.baidu.com/p/5007071765
- 生產(chǎn)力工具鏈: https://github.com/Louiszhai/tool
mac PHP環(huán)境一鍵配置
# homebrew https://brew.sh/
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# homebrew 加速源: https://mirror.tuna.tsinghua.edu.cn/help/homebrew/
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
brew tap homebrew/core
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew tap homebrew/cask
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
brew update
# 復原
# git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
# git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
# git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
# brew update
# homebrew-bottles
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# iterm2
brew cask install iterm2
# vim: 可以命令行使用 code 命令, 使用 vscode 編輯文件
# brew install vim
# fish shell: 推薦使用
brew install fish
# sudo echo '/usr/local/bin/fish' >> /etc/shells
# chsh -> 切換默認shell
# fish_config -> 配置 fish
# fish 配置目錄: ~/.config/fish
# php: 項目中目前統(tǒng)一使用 7.2
# 踩到的坑: 本地 7.3 更新 composer 后, 有的包更新后強制要求使用 7.3, 導致其他環(huán)境 composer i 失敗
brew install php@7.2
# 安裝后注意根據(jù)提示添加 PATH
# composer: https://developer.aliyun.com/composer
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
# pecl: http://pecl.php.net/
# 可以在 pecl 上下載好包后直接安裝, 避免重復網(wǎng)絡請求
# swoole
# 確保環(huán)境變量里能找到 openssl 的編譯庫
pecl install swoole-4.4.13.tgz
# 使用 `php --ini` 查找 php.ini 文件位置, 編輯添加 `swoole.use_shortname = 0`, 使用 `php --ri swoole` 確認是否生效
pecl install redis-5.1.1.tgz
pecl install mongodb-1.6.1.tgz
# protobuf
brew install protobuf
pecl install protobuf-3.11.1.tgz
# kafka
brew install librdkafka
pecl install rdkafka-4.0.0.tgz
# zookeeper
brew install zookeeper
pecl install zookeeper-0.6.4.tgz