I'm using Galileo, and I've gone:
Preferences -> General -> Editors -> Text Editors -> Spaces for tabs
but the editor still inserts real tabs when I press the TAB key. This is driving me crazy. How do I force eclipse to put in spaces for tabs? I'm editing Java files.
Thanks
What about :
Window > Preferences > Java > Code Style > Formater
and, then, edit the formating style (it'll open another dialog)
In that new dialog :
General settings > Tab policy => choose "Spaces only", instead of "Tabs only"
You can also set the "Tab size".
Go to Preferences -> Java -> Code Style -> Formatter.
Click edit next to your active profile.
Change your tab policy to Spaces Only
Related
Is there a way to configure Eclipse to not use white spaces, BUT to still only indent 2,3,? spaces instead of the standard 4? I don't want to move to white spaces instead of tabbing, because I believe this is a personal choice for the person working on the project.
The closest answer I've seen is https://stackoverflow.com/a/2477132/5525659
It works, but I'm wondering if there is a better/easier way if people are sharing files different ways?
Any insights are appreciated.
You can change the displayed tab width in Window > Preferences: General > Editors > Text Editors.
In Java, the displayed tab width can be set in the formatter profile: Window > Preferences: Java > Code Style > Formatter, in the profile dialog, in the Indentation tab, in the field Tab size.
Other editors might use the text editors preferences or have their own preferences.
I am using Eclipse Luna. I have installed the Perl EPIC plugin. I want to indent 4 spaces instead of TAB.
I have checked Window -> Preferences -> General -> Editors -> Text Editors -> Insert spaces for tabs, but still when there is need to auto indent a new line, Eclipse still indents with TAB instead of spaces.
How do I change it so EPIC will use spaces instead of tabs for indentation in Perl files?
Late answer but I ran into the same issue, found this post, and subsequently how to change the formatting settings for Perl EPIC in Eclipse.
From the main IDE workspace, click the Window menu and then choose Preferences.
Scroll down to Perl EPIC and expand it in the tree.
Click the Editor entry.
In the right panel under the Appearance tab, you can change your preferences for Insert tabs/spaces on indent and whether or not to use spaces instead of tabs.
Is there a way to have Eclipse automatically open/preview files as I select them in Project Explorer? I know I can double-click, but I want to quickly arrow up/down as I explore a project.
I am essentially looking for something like Mac Finder's Quick Look or Windows 7 Explorer's Preview Pane. IntelliJ IDEA has this functionality also and calls it "Autoscroll to Source".
Eclipse has "Link to Editor" but that works the reverse of what I want (what IntelliJ IDEA calls "Autoscroll from Source") - it updates the Project Explorer from the editor. I want the editor to update from the Project Explorer.
Window -> Preferences -> General -> Open Mode (single click)
This option open new source file in new editor tab. To disable this, and keep only one active editor tab, use:
Window -> Preferences -> General -> Editors ->
Select checkbox 'Close editors automatically' ->
Set 'Number of opened editors before closing' to 1
I think combining mishadoff's suggestion of single click open mode with "Open when using arrow keys" exactly answers OP's question:
Window(or Eclipse on Mac) -> Preferences -> General:
(I am using Juno version)
I don't want Eclipse to display any keyword in bold. I've browsed through a lot of options in the Preferences window, but could not find a way to do this. Is it possible?
This depends on the type of file you're editing. For example, in Java:
Window menu -> Preferences -> Jave -> Editor -> Syntax Colouring -> Java (in the "Element" box) -> Keywords excluding 'return' -> Uncheck bold
Similarly for "Keyword 'return'".
Look at the preview to check everything you want is no longer bold.
I am trying to adjust the width of tabs from Window -> Preferences -> General -> Editors -> Text Editors where there is a field for "Display Tab Width". But no matter what I enter there the size of indentations when I start a newline in a Java file is 4. Any ideas?
Java files have a special place to edit this setting. You need to go to
Window -> Preferences -> Java -> Code Style -> Formatter
And edit the profile.
Changing Window -> Preferences -> General -> Editors -> Text Editors tab preference is relevant for text files, not for java files as indicated here. You may create a text file in Eclipse and check that your tab size is really changed.
Check your Java->Code Style->Formatter settings, to see whether you're using tabs or spaces; you might be using spaces!
This setting is superseded for Java by the setting from the Code Style Formatter.
It can be found in Java / Code Style / Formatter (click Edit) / Indentation tab / Indentation
How to set tab size (number of spaces when you press Tab) in Eclipse or Eclipse CDT:
There are multiple places to check and things to do:
Global Preferences:
Window --> Preferences --> General --> Editors --> Text Editors --> change "Displayed tab width" from 4 to 2
Window --> Preferences --> Java OR C/C++ [depending on which you're using] --> Code Style --> Formatter --> click "Edit" button for your "Active profile" --> click "Indentation" tab on top-left --> change "Indentation size" to 2, "Tab size" to 2, and "Tab policy" to "Spaces only".
Project Preferences (these override the global settings for a given project):
Project --> Properties (or just right-click on project in the folder list at the left, and go to "Properties") --> Java OR "C/C++ General" [depending on what you're using] --> Formatter --> either uncheck the box for "Enable project specific settings", OR check that box and ensure your settings are correct (refer to 1.2 above, beginning with the click "Edit" button step, but do it from this menu this time).
To test your new settings: return to your editor and press Enter with the cursor sitting immediately after an opening curly brace ({) somewhere. It should go to a new line with the proper indentation you've set above.
NB: watch out! If you press Enter on or after a line with different indentation from what you've set above, it will duplicate that wrong indentation (by copying the style of the lines just above) rather than accepting your new indentation settings. Do NOT think it isn't working in this case! It IS working! Just delete all of the old indentation and press Enter right after a { and you'll see everything works just fine.
Version tested: All tested in Eclipse IDE for C/C++ Developers, Version: Oxygen.3a Release (4.7.3a).
Duplicate or Related Questions & Answers:
Google search for "Eclipse change tab size" - https://www.google.com/search?q=eclipse+change+tab+size&oq=eclipse+change+&aqs=chrome.0.69i59l3j0l3.2483j0j4&sourceid=chrome&ie=UTF-8
https://superuser.com/questions/462221/how-do-i-reliably-change-the-indentation-width-in-eclipse
Eclipse tab width not changing
Also Related
Set line width vertical bar marker / print margin - Is there an Eclipse line-width marker?
After digging into this more deeply, I think I've figured this out:
Java file tab DISPLAY width
Confusingly, this is under "Formatter" in preferences (like the accepted answer says). But this is inconsistent location-wise with where the option for tab display width for the non-java file Editor is located.
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.formatter.indentation.size=16
Text file tab DISPLAY width
/instance/org.eclipse.ui.editors/tabWidth=2
I emphasize DISPLAY because this is just for rendering in Eclipse. It does not change the contents of your file, and has no effect on "Source -> Format".