How to indent ONE line in Vscode by pressing Tab button? Vscode
·
Answer a question
There are some ways to do it. CMD + }, or press Tab when you select more than one line, but I want to change keybindings or install any plugin to make my Tab button work as well as Shift + Tab do.
If there are any misunderstandings I will show an example:
When I press Shift + Tab the line goes left, but this line doesn't go right when I press only Tab
Answers
- Go to Keyboard Shortcuts
- search for
indent line
- right-click on
Indent Line
entry, choseAdd Keybinding...
- in the popup box asking for a keybinding, hit Tab and Enter to accept
You'll get a custom keybinding added to the end of your keybindings.json
that looks like this:
{
"key": "tab",
"command": "editor.action.indentLines",
"when": "editorTextFocus && !editorReadonly"
}
You may want to change that "when"
clause to
"when": "editorHasSelection && editorTextFocus && !editorReadonly"
if you want it to work only when there is a selection in the line - otherwise you'll never be able to add a Tab anywhere but the beginning of a line.
更多推荐
所有评论(0)