In VSCode, what command will auto-index my current line?

I read this post about auto-formatting code and it worked when formatting some JSON. It seems to format the entire file at once. This can be somewhat harsh, for example if the indentation rules used by VS Code conflict with the project, this will lead to a lot of version control when used in a large file. How can I automatically indent from the current line?

In Emacs, the cursor can be anywhere on a line, and pressing Ctrl+ iwill automatically indent from the current line. I looked through possible keyboard shortcuts and couldn't find one that would do this. I'm looking at something like "Line Indent" but at automatic indentation.

+3


source to share


1 answer


You can simulate this by pressing ctrl+ i+ k+ f. These are two separate shortcuts: ctrl+ iwill select the current line under the cursor, and ctrl+ k+ will fformat the selection.



You can reassign the command editor.action.formatSelection

to something shorter if you want to preserve the keystrokes.

+1


source







All Articles