1 常用快捷键
单行注释 |
ctrl+/ |
多行注释 |
alt+shift+a |
复制上一行代码到下一行 |
alt+shift+↓ |
移动代码到上一行或下一行 |
alt+↑, alt+↓ |
返回到上次编辑位置 |
alt+← |
格式化代码 |
ctrl+s |
替换 |
ctrl+h |
2 快捷键简写设置
snippets设置
- shift+ctrl+p
- 输入snippets
- 点击go.json
- 在json文件中加入
// Place your snippets for go here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the // same ids are connected. // Example: // "Print to console": { // "prefix": "log", // "body": [ // "console.log('$1');", // "$2" // ], // "description": "Log output to console" // } "pln":{ "prefix": "pln", "body": "fmt.Println($0)", "description": "fmt.Println()" }, "plf":{ "prefix": "plf", "body": "fmt.Printf(\"$0\\n\",)", "description": "fmt.Printf()" }