Is there any way to replace tabs with spaces on save in files that already have tabs?
You could simply replace all tabs with spaces, but that’s going under the assumption that you don’t have ANY tabs in your files that you actually want there (eg. in strings).
Here’s a simple macro that replaces all tab characters to 4 spaces:
var editor = require("ko/editor"); editor.setValue( editor.getValue().replace(/ /g, ' ') );
You can set this macro to run “Before file save”.
Why are you using a tab character in the regex? I think it’s better to replace it with
That is more explicit yeah. It’s just a quick macro to demonstrate a use-case, let’s not start picking it apart.
You want it? Komodo’s got it! Code Menu > Untabify.
That should do what you’re looking for.
Where you was?! Ahh damn, that could save a lot of time I spent on replacing tabs with spaces
Anyway, thank you for mentioning of this feature
awesome. awesome to the max. thnaks guys.
Don’t feel bad, I didn’t know about it either