Say I have this code:
var users = [
{ name: 'TJ', email: 'tj@earnboost.com' },
{ name: 'Loki', email: 'loki@earnboost.com' },
{ name: 'Jane', email: 'jane@earnboost.com' }
];
I want to select the three lines inside the variable (in visual mode) and indent it two spaces:
var users = [
{ name: 'TJ', email: 'tj@earnboost.com' },
{ name: 'Loki', email: 'loki@earnboost.com' },
{ name: 'Jane', email: 'jane@earnboost.com' }
];
How can I accomplish that in vim?
Provided your sw
is two, you can do visually select three lines (V
) and do a >
. You can also select column of one space and three lines (ctrl-v), hit s
and replace the said space with three spaces, then hit esc and all three lines will benefit from this improvements. And there are more ways I'm sure. Normally, you'd do the >
and have your sw
set to whatever indentation you want in your code.