安装macros插件 按Ctrl+Shift+P输入setting,打开setting.json 插入下面代码

"macros":

{

"end_semicolon": // 末尾加分号 换行

[

"cursorEnd",

{

"command": "type",

"args": {"text": ";\n"}

},

//{"command":"editor.action.insertLineAfter"}, //也可以使用命令换行

],

"end_colon": // 末尾加冒号 换行

[

"cursorEnd",

{

"command": "type",

"args": {"text": ":\n\t"}

},

],

}

接着Ctrl+Shift+P输入keyboard,打开keybindings.json 插入下面代码

[

{

"key":"alt+;",

"command":"macros.end_semicolon"

},

{

"key": "alt+shift+;",

"command": "macros.end_colon"

},

]

查看原文