I have a piece of code where tabs and spaces are mixed. Gitkraken seems to put a default width of 2 spaces to the tab, while the code is formatted with 4 spaces.
Is there a way to adjust the tab-width in the gitkraken configuration?
In version 3.3.0 it is configurable in the UI:
In the Preferences > UI Preferences menu a field "Tab Size" where this can be configured.
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.
When I run the Formatter it indents string literal lines all the way to the last line of the variable name, even if that exceeds the column guide, as shown in this screenshot:
Ideally, I want all of the lines to be wrapped similar to the way the first line is wrapped, with just a couple of tabs (or 1 tab if possible). I've changed all the Formatter settings for assignment and binary expression and it doesn't affect the Formatter's line wrapping behavior.
Is there a way to make Eclipse wrap lines like NetBeans or maybe with some plugin?
Here's what my Formatter settings are for Line Wrapping:
Plugins
Eclipse Colorer
has an "Enhanced and fixed word wrapping mode".
Eclipse Word-Wrap
is dedicated to word wrapping and might do the job.
Customization
Here's how and where you do it in Eclipse: Preferences->Java->Code Style->Formatter, then click the Edit button and select the Comments tab. After that, the same place, you can select the Line Wrapping tab and the Indentation tab. You can also set margins and tab sizes in Preferences>General>Editors>Text Editors by editing the Displayed Tab Width
I'll note that the Eclipse version should be Eclipse Project Neon (4.6) M4 or higher because Eclipse 4.6 came with some updated word wrapping out of the box.
I recently moved from geany to Aptana as I'm working on some bigger projects and felt I would benefit from a full IDE.
One feature I'm really missing is the little grey line every four spaces to help me maintain indentation consistency. Does anything like this exist for Aptana/Eclipse?
get the PDT tools Indent Guide plugin
Under
Preferences -> General -> Editor -> Texteditor you can activate "Show whitespace characters". If you click on "whitespace characters", you can define, which character should be displayed. Here you can active "Tabs". It's not as good as the lines from Notepad++, but better than nothing.
You can set a print margin indicator (vertical line) in Preferences > General > Editors > Text Editors - but this would only be a single line. You could use tabs instead of spaces - there are options to insert spaces when you use the Tab key. In this same menu, you can choose to show whitespace characters, which will help keep your spacing in order. I don't know of any grid options.
Somehow I've turned on hidden characters in Eclipse. It's not the "whitespace" characters in the general editor preferences. When turned on, it adds another layer of hidden characters over the existing ones.
Then I have things like
\r\n
Does anyone know what these are and how to remove them?
It is under Preferences > General > Editors > Text Editors. There is a checkbox labeled "Show whitespace characters". If you uncheck this the editor switches back to normal.
If you click on the link (whitespace characters) (<= v3.6) or (configure visibility) (>= v3.7) in this line you will get a popup window, in which you can define which characters eclipse is supposed to consider as whitespace characters.
In this popup window you also get the option to define the transparency in which each whitespace character is displayed in the editor, which you can use to (indirectly) change their foreground colour. I'm just mentioning it here, because it took me about half an hour to find this setting! ;-)
There is a toggle button 'Show Whitespace Chars' on the Eclipse toolbar
A great tip about using 'quick access' from eclipse forum:
CTRL+3 swc
Allows to turn them on and off
The right shortcut is Ctrl + N
UPDATE From Eclipse 3.7 version, something is changed... Now you have to go to:
Window > Preferences > General > Editors > Text Editors
CTRL + . does the job.
For Aptana Users
To toggle hidden characters in Aptana on and off, use the following keyboard shortcut:
Ctrl+Alt+W
I am using Eclipse Oxygen and can see this option to toggle whitespace characters:
It is actually in two places...
Sandkastenliga points out the obvious one, but you can also show white space with a shortcut key combination. The key combination is separate from the text editor preferences and will superimpose additional characters when active (it uses \r and \n for carriage return an line feed respectively instead of the symbols used by the text editor preference.)
Go to preferences > general > keys and look for the binding for the 'Show Whitespace' command.
I have the text editor preference turned on, so I removed the binding for this command altogether (it was set to Ctrl+. in my profile) to prevent accidental activation as it doesn't affect the other preference.
Go to Window > Preferences > General > Editors > Text Editors
Uncheck the "Show whitespace characters" option on the right side of the page, then click "Apply" at the bottom of the page.
Since this is not a standard setting, it could be the result of one of your extra plugin.
Did you try starting your eclipse with the -clean parameter?
Do you reproduce the issue with a fresh Eclipse installation?
Go to Preferences > General > Editors > Text Editors and restore defaults.
I have done this several times by accidentally hitting some keystrokes.
If you go to Windows/Preferences/General/Keys you will see all the keyboard shortcuts you have.
Mine is set to Control + .
I had to place my cursor inside the document and do it a couple of times to make it work because there is also a keyboard shortcut for Control +
Hope that helps.
You can add "Show Whitespace Characters" button in toolbar by customizing your perspective.
It also contains buttons to toggle word wrap, and toggle selection mode.
Go to Window > Perspective > Customize Perspective > Action Set Availability, then select "Editor Presentation" action set:
This works in Eclipse Neon.
You can also add a key binding for this action.
Go to Preferences > General > Keys > "Show Whitespace Characters"
Sorry this is a bit vague but it's a while since i used Eclipse and i do not have it installed. I think this is it ..... in one of the menus you will find the Eclipse settings, there are two set's of settings, current project and overall Eclipse, you mat need to check them both. In there are various menus in tree form that allow you control the actions and look and feel. But some of them are nested so there is an overall control but some packages have their own options in a sub menu set. The menu's will expand when you click them and i'm afraid you need to walk through them all.
Eclipse > Preference > General > Editors > Text Editors > Show WhiteSpace characters.
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".