Move selected text to the left or right in Visual Studio Code

Moving blocks of text

A workaround for moving a block of text of just one space is to use the "column selection" feature of Visual Studio. here the detailed instruction:

  • move the cursor at the upper left corner of the block of text you want to shift;
  • click with the mouse holding down shift + alt, on the down left corner of the block of text you want to shift;
  • now you could insert as many spaces as you want.

If you need more info on Block Selection in Visual Studio you could easily find information on the official documentation or here: enter link description here Pay attention in the link the shortcut is wrong, at least for me.


Indentation

For moving the text right and left you can use TAB key:

  • TAB move the selected text right
  • SHIFT + TAB move the selected text left

This feature has been implemented by a pull request some time ago.

To use it you need to bind the editor.action.moveCarretLeftAction and editor.action.moveCarretRightAction actions in the keyboard shortcuts editor.

Animation showing how the solution works