Reputation: 20232
I know I can manually replace tabs to spaces like this:
F1
,indentationToSpaces
Enter
.Is there a way to do this for all files in a folder (+ files in subfolders)?
Upvotes: 2
Views: 1459
Reputation: 4381
Ok. I think, you are looking for an extension.
But my answer is a litle trick - using the global replacer
with regex:
We change step by step to save the amount of indentation and replace tabs
only in the start of line.
The below snippet shows replace step by step,s
presents one space
and _
precents one tab
:
test = '_____Text__'
for(let i=0; i < 7; i++){
test = test.replace(/^([ ]*)(_)/, "$1 ")
console.log( 'step', i, test.replace(/[ ]/g, 's'))
}
You may use two spaces instead one.
But this solution has 1 issue - after replace you must update regexp (for example: add and remove space) for activate this button again
So at the end steps look like:
regexp
, replace
, files to include
replace
regexp
or click twice on one of this buttons: step 2
some timesUpvotes: 1