How to Tab the Cursor in Vs Code?

Asked

Viewed 467 times

2

I have Windows 10 and I use Vs Code. I want to tab my cursor, but when I press the tab key, what happens is that the cursor starts to select the first item of the terminal header (and is navigating the commands of Vs Code) instead of giving a tab space.

How can I give a tab? Will I have to edit the behavior of the key? If yes, how does it in Vs?

  • 2

    Does this only happen inside the terminal? Have you installed any format extension or something like that for the terminal? Already logged into the Settings Json or Shortcuts list to see what is assigned to Tab ?

2 answers

2


TAB configuration in Vscode

Log in to Json dos Settings or on the list of Shortcuts to see what is assigned to Tab. The option is to change the use of Tab in the VS Code settings.

Go on File > Preferences > Settings and search for "Tab" and check the "editor.tabSize": 2,

You can also Ctrl+A to select all lines in the file. Then go to ctrl + shift + p > indent and choose the format you want. The option is to change setting the use of Tab in the VS Code settings.

You can also open the file keybindings.json, in the Command Palette (Ctrl+Shift+P), Search by Preferences: Open Keyboard Shortcuts (JSON), but it is read-only.

Self-identification

One of the shortcuts to indent in Visual Studio Code

in windows you use Shift + Alt + F

On the Mac is Shift + Option + F

And on Linux it’s Ctrl + Shift + i

Extensions

Depending on the language you are using, you can download some Code Formatter plugin for the specific language you are going to use. Just search the VS Code extension gallery: "SuaLinguagem Formatter".

I recommend to Beautify that you can find in the Market Place of VS Code. Beautify Or Prettier depending on the code you want to format... Prettier

To match with the = in the same space, we also have the extension Better Align that does just that and you can configure on the keyboard the shortcut you want. Documentation

Goes into File > Preferences > Keyboard Shortcuts And create your shortcut like this for example:

{ "key": "ctrl+alt+i",  "command": "wwm.aligncode",
                           "when": "editorTextFocus && !editorReadonly" }

1

What solved was more or less that below, that @Rebecanonato spoke:

"You can also open the keybindings.json file, in the Command Palette (Ctrl+Shift+P), search for Preferences: Open Keyboard Shortcuts (JSON), but it is read-only."

By giving Ctrl+shift+p, and searching for Keyboard, I selected "Help: Keyboard shortcut Reference", and then opened the list of configured commands.

It said that the Ctrl+M changes the tab key "focus of use". And then when giving this command, Tab started to give a tab space.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.