我想知道是否可以在不删除标记文本的情况下使用 Tab 键缩进一行。
在 GIF 的第一部分中,您会看到 Visual Studio Code,在第二部分中看到 Atom。 Atom 显示了所需的行为。
到目前为止,可以在 VS Code 中以这种方式缩进多行,它也适用于 backtab,但不适用于 tab 和单行。
这是错误还是正常行为?
我的设置:
Visual Studio Code:版本 1.25.1(MacOS 10.13.6 High Sierra)
Visual Studio Code:版本 1.25.1 (Ubuntu 18.04 LTS)
最佳答案
You could use this default keybinding:
{
"key": "ctrl+]",
"command": "editor.action.indentLines",
"when": "editorTextFocus && !editorReadonly"
}
以制表符单行或多行。如果您希望绑定(bind)到选项卡,您可以将其修改为:
{
"key": "tab",
"command": "editor.action.indentLines",
"when": "editorHasSelection && editorTextFocus && !editorReadonly"
}
我添加了
editorHasSelection
子句,因此当在您的行上选择某些内容时,它仅运行 ,但是您将失去正常的简单选项卡行为(您不喜欢)。关于visual-studio-code - Visual Studio Code - 使用制表符键缩进单行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51419378/