Golang Settings
Visual studio Keymap
| name | hotkey | Desc |
|---|---|---|
| Open in terminal | Alt + C | |
| Show in Explorer | Alt + W | |
| Recent Files | Ctrl + E | |
| Go to Declaration or Usages | Shift + F12 | |
| Reformat Code | Ctrl + Alt + Enter | |
| Split Right | Ctrl+W, V | |
| Split Down | Ctrl+W, S | |
| Split and Move Down | Ctrl+W, Down | |
| Split and Move Right | Ctrl+W, Right | |
| Close | Ctrl+W, C | |
| UnSplit | Ctrl+W, U | |
| Goto Previous Splitter | Ctrl+W, H | |
| Goto Next Splitter | Ctrl+W, L | |
| Undo | Ctrl + U | |
| Redo | Ctrl + R | |
| Add to Watches | ` | |
| Move Caret Backward a Paragraph | F1 | |
| Move Caret Forward a Paragraph | F2 | |
| Add to Watches | ` | |
| Move Right | Alt+Right (default) | |
| Move Left | Alt+Left (default) | |
| Toggle Bookmark with Mnemonic | Ctrl+F11 (default) | 會有選單讓您設置書籤編號 |
| Show Bookmarks | Ctrl+` (default) | 出現選單讓您選擇要到哪一個bookmark的標籤去 |
| Toggle Bookmark | Ctrl+K , Ctrl+K, Ctrl+K | 按一次可以新增書籤(無編號書籤),在以新增的書籤在按一次則取消書籤 |
| Move Caret to Code Block Start | Alt+Shift+[ | 跳到括號的開端 |
| Move Caret to Code Block Start with Selection | Alt+Shift+[ | 和上面的差別,這個會再把所選區域反白 |
| Move Caret to Code Block End | Alt+Shift+] | |
| Move Caret to Code Block End with Selection | Ctrl+Alt+Shift+] | |
| Fold Selection / Remove region | Ctrl + . ] | 相當好用,相當於把當前的括號顯示或隱藏 |
| Move Caret Backward a Paragraph | F6 | 往前移到整列為空白的列 (vim也有類似的指令: shift + [ ) |
| Move Caret Forward a Paragraph | F8 | 往後移到整列為空白的列 |
| Open source in new window | Shift+F4 (default) |
| name | checked (☐☑) | Description | 設定位置 |
|---|---|---|---|
| Add leading space to comments | ☑ | 可以在打完註解//自動多一個空白 | |
| Insert Paired brackets (), [], {}, <> | ☐ | 我是不喜歡這種設定,很愚蠢,每次打完還要再用方向鍵不能連著打 | Editor > General > Smart Keys |
| Insert pair quote | ☐ | 同上 | Editor > General > Smart Keys |
Change font size withCtrl+Mouse Wheel | ☑ | 可以用滾輪來改變font-size |
使用滑鼠滾輪來改變font-size
Editor → General:
☑ Change font size with Ctrl+Mouse Wheel
Editor
Font
- Font:
JetBrains Mono(或Fira Code Retina - Size: 18
☑ Enable font ligatures: 這個選項勾起來之後,可以啟用連字,可以把!=做成像「≠」的效果!
關於go fmt
不需要特別用Plugins → Go → Go Fmt File
可以運用預設的Reformat Code
比較快,而且兩個的結果是一樣的
FAQ
打開多個專案
造理說 Open資料夾 預設會問你的附加方式是什麼
選擇Attach可以把資料夾附加到當前的專案下,但如果一直沒辦法成功
可以在
Settings > Project Structure
+ Add Content Root (點選這個新增上去,也可以達到相同的效果
IDE一直沒辦法讀取到正確的Module
Settings > Go > Go Modules
☑ Enable Go Modules Integration 這一項記得打勾
Enable Go Modules Integration : 這個東西指的就是go.mod
在舊版的go沒有go.mod這種東西(在go1.11前沒有(GO111MODULE的3個1就是指這個)),所以這項設定要自己去打開
其實我覺得要自動開啟了,新人我想都對go.mod略知一二,預設不開啟只是給人添麻煩而已。
JSON設定
Settings -> Code Style -> JSON -> Wrapping and Braces
可以對Arrays, Objects進行設定
建議把Arrays改成
Wrap if long,這樣可以將{ "data": [ 1, 2, 3 ] }變成
{ "data": [1, 2, 3] }
Markdown MMD
MMD(MultiMarkdown). It supports more export-formats and implements some added features currently not available with plain Markdown syntax.
Mermaid
Languages & Frameworks
-> Markdown.
-> Enable either Mermaid or PlantUML under Markdown extensions.
其他參考連結
它會自動幫你下載,但是下載的版本可能是舊版的,導致有些語法會有問題,建議您可以把它替換掉
替換方法,來到此工作目錄
%userprofile%\AppData\Local\JetBrains\GoLand2020.3\download-cache\mermaid\mermaid
把mermaid.js替換掉即可,可以到此下載mermaid.js
您可以載min.js,再把它更名就好了
pie title Pets adopted by volunteers
"Dogs" : 386
"Cats" : 85
"Rats" : 15