How to re-apply indentation to a whole document or section


I have indentation set to use spaces, 4 spaces per tab.
In some old or mistreated documents I have some sections where indentation is made with two spaces instead of four.

I could not find a way to select the section and re-apply the correct indentation.

Currently I need to go through the whole document and correct the indentation selecting those lines that have the same indentation, remove that indentation and applying the new one.

I cannot do as I would think is the appropriate way:
select section or whole document
select: code>format>document|selection using>Reindent

because in that case the re-indentation does not apply to the inner indentation, only to outermost indentation.

Komodo IDE, version 10.2.2, build 89895, platform win32-x86. Built on Fri Apr 28 17:11:08 2017

What would the correct way be?

The Reindent formatter is actually called Python Reindent, meaning it only works for Python.

We currently do not have a language agnostic reindenter, I’m sorry. You could try configuring a formatter for your language to only fix the indentation.

Hi, you may be able to get away with selecting everything you want to re-indent, indenting it once, and then unindenting it once.

Unfortunately it did not work. Thank anyway!

OK, actually I remember now that I’ve been bitten by this before.
I found a relevant documentation:
But because I’m working on a Windows laptop (but I’m best fluent on Linux system admin, LOL) I’ll save this for my next life.

I were wondering about a simple userscript that will replace e.g. 2 spaces with 4 spaces. (though tab-based indentation would be the winner there because you can easily change tab width :stuck_out_tongue:)
Should be easy to implement. If you’re interested, tell me.

Such a userscript would only be able to safely replace indentation at the start of each line, and not in-line indentation.