如何在 macOS 輕鬆使用 Visual Studio 熱鍵?
只要安裝了 Parallel Desktop,就可以在 macOS 執行 Windows 10 與 Visual Studio,但一些 Visual Studio 的熱鍵會先被 macOS 攔截,且 mac 鍵盤又天生沒有 Home / End / Page Down / Page Up,再加上 Touch Bar 之後,我們會希望盡量不要用到 F1 ~ F12,在種種條件下, 我們該如何在 macOS 上高效率的使用 Visual Studio 呢 ?
Version
macOS High Sierra 10.13.3
Parallel Desktop 13 for Mac Pro Edition 13.3.0 (43321)
Windows 10 Pro 1709 16299.251
Visual Studio 2017 15.5.7
Home
Visual Studio 熱鍵眾多,在此先針對最常用的熱鍵處理,只要學會方法,可自行舉一反三。

- 選擇要設定的 VM
- 按滑鼠右鍵選
Configure…

- 選
Hardware - 選
Mouse & Keyboard - 按下
Open Shortcuts Preferences…

- 選擇你要設定的 VM
- Profile : 選擇 Widnows,Parallel Desktop 預設已經幫我們根據 macOS 的習慣,預先設定了相對應的 Windows shortcut mapping
- 若你修改了 mapping 之後不滿意,可以隨是按下
Restore Defaults回到 Parallel Desktop 預設所提供的 shortcut mapping - 按下
+新增 shortcut : 雖然已經內建一下 shortcut mapping,但對於 Visual Studio 的使用仍然不足,我們必須自行增加 mapping

根據 macOS 的習慣,⌘ + ← 相當於 Windows 的 Home。
From:設定 macOS 的 shortcut,To:設定 Windows 的 shortcut。
因為 Mac 鍵盤沒有
Home,可用下拉選單選擇Home,或者輸入fn + ←
End

根據 macOS 的習慣,⌘ + → 相當於 Windows 的 End。
Page Up

根據 macOS 的習慣,⌘ + ↑ 相當於 Windows 的 Page Up。
Page Down

根據 macOS 的習慣,⌘ + ↓ 相當於 Windows 的 Page Down。
Shift + Home

根據 macOS 的習慣,⇧ + ⌘ + ← 相當於 Windows 的 Shift + Home。
Shift + End

根據 macOS 的習慣,⇧ + ⌘ + → 相當於 Windows 的 Shift + End。
Delete Line

根據 JetBrains 習慣,⌘ + ⌦ 相當於 Delete Line,這在 Visual Studio 對應的熱鍵為 Ctrl + Shift + L。
Start Without Debugging
Start without Debugging 也是 Visual Studio 常用的熱鍵,但預設是 Ctrl + F5,對於 macOS 而言,一般我們不會用到 F1 ~ F12,而是將這些熱鍵讓給 Touch Bar,所以建議更改 Visual Studio 熱鍵。
將 ⇧ + ⌥ + R 設定為 Start without Debugging。

Tools -> Options

- 選擇
keyboard Show commands containing輸入Debug.Start- 選擇
Debug.StartWithoutDebugging - 新增
Shift + Alt + R熱鍵
Start Debugging
Start Debugging 也是 Visual Studio 常用的熱鍵,但預設是 F5,我們一樣希望 F1 ~ F12 讓給 Touch Bar,所以建議更改 Visual Studio 熱鍵。
將 ⇧ + ⌥ + D 設定為 Start Debugging。

- 選擇
keyboard Show commands containing輸入Debug.Start- 選擇
Debug.Start - 新增
Shift + Alt + D熱鍵
Conclusion
- 若是熱鍵被 macOS 攔截,可在 Parallel Desktop 設定 shortcut mapping
- 若是 Visual Studio 的預設熱鍵不滿意,可在
Tools -> Options重新設定熱鍵