eclipse: changing the # of spaces to indent/unindent
Asked Answered
M

2

7

How do I adjust the # of spaces added/removed by Eclipse when I hit Tab or Shift+Tab, for a given filetype? I am working on reStructuredText files (.rst) and want 2 spaces for those instead of 4.

Mckinley answered 14/1, 2010 at 18:11 Comment(0)
A
7

From the Window menu, choose Preferences. Navigate down to General: Editors: Text Editors: Displayed tab width.

You may also want to check out the code style for some other types of editors, because they decide whether to use tabs or spaces, and the size of the tab stops.

Hint: In the top left of the preferences dialog, you can type "tab" where it says "type filter text", and it will show you all settings related to tabs.

Arlie answered 14/1, 2010 at 18:15 Comment(2)
neat. is there a way to do it on a per-file-type basis?Mckinley
Not sure. You can change it for a specific project. You can also associate a particular editor with the .rst file type. My set of plug ins includes separate tab settings for C, Java, HTML, JavaScript and XML editors. If you're not using one of those for anything else, you could associate it with .rst and set the tab width to 2. You might also want to check out the AnyEdit plug in, I seem to remember it had a bunch of options.Arlie
D
0

You can associate an editor to a particular type of file in General -> File Associations.

Add your file type (*.rst) and then add an editor.

Go to editor preferences and specify tab policy, in Aptana Studio there's an 'Editors' subsection where you can do that, or you can just associate a random editor that you don't use with a file type you'd like a custom tab spacing to apply.

This works well for me with *.pt and xml editor --eclipse.org explanation

You might want to try this -- http://resteditor.sourceforge.net/ (taken from here)

Darcydarda answered 28/11, 2012 at 16:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.