使用Microsoft的VisualStudio代码,如何复制一行代码,然后上下移动?(类似于cmd+Shift+d行为)
这是一个我经常使用的特性,而且在没有它的情况下,使用VisualStudio代码是很困难的。
发布于 2017-12-27 09:23:52
你正在寻找的命令是editor.action.copyLinesDownAction
和editor.action.copyLinesUpAction
。
您可以通过选取来查看相关的按键绑定:文件>首选项>键盘快捷键
Windows和Mac:
Shift+ Alt+ Down和Shift+ Alt+Up
Linux的:
Ctrl+ Shift+ Alt+ Down和Ctrl+ Shift+ Alt+Up
此外,命令editor.action.moveLinesUpAction
和editor.action.moveLinesDownAction
对移动线的,他们必然Alt+ Down和Alt+ Up在Windows和Mac Ctrl+ Down和Ctrl+ Up在Linux上。
发布于 2017-12-27 10:14:15
您可以从
文件>首选项>键盘快捷键
默认的键盘快捷键是,
复制行下动作:Shift+ALT+down
复制行向上操作:Shift+ALT+UP
上移线:ALT+UP
下移线:ALT+down
或者您可以覆盖键盘快捷键。
文件>首选项>键盘快捷键
并编辑keybindings.json
例子:
[
{
"key": "ctrl+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+up",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus"
},
{
"key": "ctrl+shift+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus"
}
]
发布于 2017-12-27 11:37:47
我用ctrl+c ctrl+v
,这将复制和粘贴线,从而产生类似的效果。*)
https://stackoverflow.com/questions/-100007098
复制相似问题