Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replace four spaces with a tab in Sublime Text 2?

enter image description here

I want to replace all the "four spaces" that is written by another text editor with tabs. How can I do it?

like image 483
Mohsen Avatar asked Mar 05 '12 23:03

Mohsen


People also ask

How do I change tabs to 4 spaces in Sublime Text?

To configure the tab width in Sublime Text 3, click on “View” in the top bar, then click on “Indentation” in the drop-down list. Next, in the second level of the drop-down list select the width you want a tab to take up. Sublime Text 3 defaults to tabs being four spaces wide.

How do I add a tab in Sublime Text?

If you want to use a tab in search/replace, just type a tab on a new line ("Indent using spaces" disabled), select and cut and then paste into either search or replace field.

How do I fix sublime spacing?

by pressing ctrl+f12, it will reindent your file to a tab size of 4. if you want a different tab size, you just change the "value" number.


2 Answers

Bottom right hand corner on the status bar, click Spaces: N (or Tab Width: N, where N is an integer), ensure it says Tab Width: 4 for converting from four spaces, and then select Convert Indentation to Tabs from the contextual menu that will appear from the initial click.

Similarly, if you want to do the opposite, click the Spaces or Tab Width text on the status bar and select from the same menu.

enter image description hereenter image description here

like image 121
ncremins Avatar answered Oct 13 '22 09:10

ncremins


Select all, then:

Windows / Linux:

Ctrl+Shift+p

then type "indent"


Mac:

Shift+Command+p

then type "indent"

like image 41
Web_Designer Avatar answered Oct 13 '22 09:10

Web_Designer