9

If you create a file using gedit, which is configured to insert 4 spaces each time you press tab. Then for some reason you edit the file and some tabs get inserted (i.e. While editing on Windows). How can you replace those tabs back to spaces using gedit?

3 Answers 3

12

To do that you just need to use the replace form and search for: \t (backslash followed by t) then replace it with four spaces.

Source

4
  • well, not in my gedit :) Commented Sep 17, 2014 at 21:44
  • I think I had to change settings in three places. Edit, preferences, editor, indentation. And preferences files when saved change tabs to spaces. And under project properties, indentation.
    – oldfred
    Commented Sep 17, 2014 at 22:52
  • @oldfred I see, then I'd prefer my good old python :) Commented Sep 18, 2014 at 18:53
  • Those are one time changes. And if you have tabs the change on save mode converts tabs to spaces automatically.
    – oldfred
    Commented Sep 18, 2014 at 19:16
4

You can highlight, copy and paste a 'tab' from your file into the search and replace fields to achieve this in either direction tabs>spaces or spaces>tabs.

0

I think that the correct answer is "No, looks like gedit can not do that."

Replacing a tab with a fixed number of spaces simply does not do the trick! Because a TAB adds a variable number of spaces to reach the next tab-stop.

I do not see how gedit can do that - unless I am missing something. Use vim instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .