Block indent


Is there a way to select a block of code and have all lines indent the same amount to the left or right?


Don’t TAB and SHIFT-TAB do that?


Also CMD+[ and CMD+] on OSX…


And CTRL-[ and CTRL-] on non-macs


TAB only shifts the entire block.


I don’t understand. Isn’t that what you asked for?


If you want to align all the lines too, you can shift them all left first until they’re all at the left margin, then shift them all right to where you want them.


For example if i have:

fields: {
            username: {
                validators: {
                    notEmpty: {
                        message: 'The username is required and cannot be empty'
            password: {
                validators: {
                    notEmpty: {
                        message: 'The password is required and cannot be empty'
            email: {
                // Initially, the validators of this field are disabled
                enabled: false,
                validators: {
                    notEmpty: {
                        message: 'The email address is required and cannot be empty'
                    emailAddress: {
                        message: 'The email address is not valid'

Each line is tabbed over 2, I would like to select the entire block and indent all lines at the same time.


If you select the block and press Tab that will indent all the lines at the same time by one additional tab length.


Indent right: press tab
indent left: shift tab

hope that helps


Use Alt+Shift+Up/Down(arrow keys) to create multiple cursors, then add or delete space/tabs. You can also use Ctrl+click with mouse to create multiple cursors.


You might be interested to know:

Ctrl-[ and Ctrl-] works very well for indent and outdent of a selected block of code.


That is very helpful to know, thank you!