Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adobe brackets: write spaces instead of tabs

I am using brackets with coffeescript, but when I hit Tab, it insert a tabulation whereas i only need 2 spaces. Also, when I create a line break, the indent is tabs, and not spaces. Can I change these 2 setting ?

like image 302
Vinz243 Avatar asked Mar 20 '14 17:03

Vinz243


People also ask

How to indent in Brackets?

brackets-autoindent-extension This extension adds auto-indent function to Adobe Brackets. If you install this extension, you can invoke by "Edit > Auto Indent" menu or "Ctrl+Shift+I" key.

Is tab equal to 2 spaces?

Generally, a tab is the same width as 4 to 5 spaces provided the font being used equally sizes each character. For example, the Courier font's tab equals 5 spaces, whereas the Arial font is 11 spaces to each tab when the font size for both is set to 12.

Is 4 spaces a tab?

In most code editors, tabs are not the same as 2 spaces or 4 spaces by default. A tab is stored differently than spaces in the code. Tabs can be seen as a big “jump” in the text, while spaces are always 1 space each.


2 Answers

In the lower-right of the status bar you should see an indicator saying "Tab Size." Click the label to toggle to spaces. To change the amount of indent, click the number next to it and type a new value.

Note: if the indicator already says "Spaces" then Brackets should be using spaces instead of tab characters already. But it might not feel that way because when you move the cursor or press Backspace, there's a "soft tabs" behavior: the cursor will smartly skips over contiguous spaces to line up evenly with the next tab stop. If that bothers you, there will be a preference in the next release of Brackets (Sprint 38) to disable that behavior, making the cursor never move more than one space at a time.

like image 146
peterflynn Avatar answered Sep 25 '22 18:09

peterflynn


For language specific control, Brackets allows you to provide different tab and space indentation values in the brackets.json file. For example:

"language": {
    "html": {
        "spaceUnits": 4
    },
    "javascript": {
        "tabSize": 2
    }
}
like image 40
Iain J. Reid Avatar answered Sep 22 '22 18:09

Iain J. Reid