VScode快捷键设置和代码简写

1 常用快捷键

单行注释

ctrl+/

多行注释

alt+shift+a

复制上一行代码到下一行

alt+shift+↓

移动代码到上一行或下一行

alt+↑, alt+↓

返回到上次编辑位置

alt+←

格式化代码

ctrl+s

替换

ctrl+h

2 快捷键简写设置

snippets设置

  1. shift+ctrl+p
  2. 输入snippets

  3. 点击go.json

  4. 在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()"
    	}
发布了14 篇原创文章 · 获赞 7 · 访问量 995

猜你喜欢

转载自blog.csdn.net/weixin_39966701/article/details/105333701
今日推荐