Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change indentation mode in Atom?

I haven't been able to figure this out yet. Atom seems to use spaces as the default indentation mode. I prefer to have tabs instead though. Sublime Text has built in functionality for switching and converting indentation.

Anyone found out how to change the indentation mode of Atom?

Some screenshots from Sublime Text:

Sublime Text indentation menu openSublime text indentation menu

like image 489
Jon Koops Avatar asked Mar 24 '14 11:03

Jon Koops


People also ask

How do you auto align in Atom?

atom-alignment packageUse ctrl+cmd+a on Mac or ctrl+alt+a to align multiple matches. If you want to align the first match only, call Atom Alignment:Align from the command palette.

What are atomic soft tabs?

Atom soft tabs aren't configurable the way hard tabs are, that's why this package comes to the rescue: it provide an easy way to display consistent soft tabs length between different editors configurations. Pretend that your are working on a project with soft tabs of 2 spaces .


4 Answers

See Soft Tabs and Tab Length under Settings > Editor Settings.

To toggle indentation modes quickly you can use Ctrl-Shift-P and search for Editor: Toggle Soft Tabs.

like image 197
blom Avatar answered Oct 06 '22 23:10

blom


Go to File -> Settings

There are 3 different options here.

  1. Soft Tabs
  2. Tab Length
  3. Tab Type

I did some testing and have come to these conclusions about what each one does.

Soft Tabs - Enabling this means it will use spaces by default (i.e. for new files).

Tab Length - How wide the tab character displays, or how many spaces are inserted for a tab if soft tabs is enabled.

Tab Type - This determines the indentation mode to use for existing files. If you set it to auto it will use the existing indentation (tabs or spaces). If you set it to soft or hard, it will force spaces or tabs regardless of the existing indentation. Best to leave this on auto.

Note: Soft = spaces, hard = tab

like image 43
developerbmw Avatar answered Oct 06 '22 23:10

developerbmw


Add this to your ~/.atom/config.cson

editor:
    tabLength: 4
like image 27
Leif Gruenwoldt Avatar answered Oct 06 '22 23:10

Leif Gruenwoldt


OS X:

  1. Go to Atom -> prefrences or CMD + ,

  2. Scroll down and select "Tab Length" that you prefer.

enter image description here

like image 18
Said Kholov Avatar answered Oct 06 '22 22:10

Said Kholov