Change Eclipse tab to correctly indent line as Emacs does - eclipse

In Emacs when I hit tab anywhere on a line, the line will indent correctly (or at least to the mode settings). When I hit tab again it will move back to the next block. When programming Python this really helps since closing a block is done by lowering the indention level.
Is there a way to configure Eclipse to do the same?
Currently, I have to erase the leading white space then hit tab.
This question is a reposting of a superuser question.

Try ctrl-i (Cmd-i on osx) to indent the current line or a selection inside eclipse (if you're using default key binds as opposed to emacs). Or, if you want a different key bind, go to Appearances > General > Keys and change the bind for Correct Indentation to key(s) of your choice

In Eclipse, go to Windows -> Preference -> Java -> Formatter.
In Active Profile drop down box, select any profile, click Edit on right of it.
In Profile Dialog box opened, you can change a lot of things like Indentation, New Line, Braces, White Spaces etc.
Alternatively, if your profile is altogether different than standard one, Create a new active profile and then edit it accordingly.

Related

Unwanted sign on each line of worksheet

I don't know what the hotkey I accidentally clicked, but this Ǧ looking sign appeared on every line of code, and there are grey dots instead of spaces in the code.
How can I get rid of those characters?
Assuming this is SQL Developer, go to Tools->Preferences (or on Mac, find that under the SQL Developer menu). Expand the Code Editor section and click on Display. Untick "Show whitespace characters" (second checkbox in the list).
You can check for defined shortcuts under Preferences, in the Shortcut Keys section. On Mac there isn't one for this, but Windows has it as Control+Shift+W, which will also toggle them off if you don't want to go through the preference pane.

How do I disable brace highlighting in JetBrains RubyMine?

I want to disable brace contents highlighting in RubyMine. It's very distracting. Instead of having the entire string highlighted I only want the braces themselves highlighted and if that is not possible I need it disabled. Is this possible?
Things I've done already to no success:
Enabled/disabled all highlight options under Settings/General to no
effect. I'm running RubyMine v8.0.3.
Read the documentation.
jetbrains.com/idea/help/highlighting-braces.html?search=highlighting
I've also read this document that states how to disable highlighting
of usages by simply pressing escape - it does not work.
jetbrains.com/idea/help/highlighting-usages.html#3
current brace highlighting that I need disabled
Your file type seems to be HAML.
In Settings, go to Editor > Colors & Fonts > HAML. In the lower right area, you see demo code in HAML. Look for the right spot in the code and click on it.
You will probably click on the second line because there is some code in braces. In this case, RubyMine will select the entry Injected code in the list. The check box Use inherited attributes tells you that this settings is inherited.
Now you have to choose:
If you want to change the setting for Editor > Colors & Fonts > HAML - Injected code, switch off Use inherited settings, then switch off "Background".
If you want to the settings for injected code in all languages: Click on the link "General" (on the right). RubyMine will switch to Editor > Colors & Fonts > General - Injected language frament. Now switch off "Background"
Before modifing anything, you have to create a new scheme. The default scheme is read only. Click on Save As..., choose a name and press 'OK'.
Open the Settings/Preferences dialog.
In the Editor page of the IDE Settings, select the check box Highlight usages of element at caret to enable automatic usage highlighting.

Replace spaces with tabs using Eclipse

I downloaded some code from the Internet, and the four-space indentation is bugging the crap out of me. I tried to do a find and replace for "<4 spaces>" and replace it with "\t", but that just replaced all sets of spaces with the string "\t". How would I put a tab in the "replace" box?
Open Window->Preferences from menu bar.
Select Text Editors from tree menu.
Uncheck Insert spaces for tabs.
After that, run Format menu from context menu and save the file:
I figured it out. I just check the box that says "use regular expressions", then use \t.
In answer to the second half of your question:
The reason why people like spaces more than tabs is consistency. If you have your editor set to show tabs as 4 spaces wide, and I have my editor set to show tabs as 8 spaces wide, the code we're writing will look different to each of us. That's okay until our mutual coworker forgets that we're using tabs and starts spacing his lines using 4 spaces. Now his code looks fine to you, but all the indentation is off to me.
Also, what happens when our work decides that lines should be 80 characters long, or 120 characters long? You'll happily code with 4 space tabs, and when it gets to my editor, I suddenly see some of your lines as too long.
Generally, it doesn't matter whether you use spaces or tabs, as long as you (and every person who works on your code) agrees on which to use, and how wide a tab character is.
I use 4 spaces everywhere, because it looks the same on every editor, every repository, when cated, and everywhere else.
Kouhei response is in the right track, but you'll need to change the options of the Java formatter if you want the auto formatter to use spaces (in the preferences, look for Java -> Code Style -> Formatter, create a new style from one of the existing one, and choose "always use spaces"). Then, Ctrl + Shift + F will remove the tabs and insert spaces.
To resolve the issue of tab with space in the Eclipse editor:
Menu Window --> Preferences --> Java --> Code style --> Formatter
Click on configure project specific settings.
Choose the project
Check Enable project-specific settings
Click on New
Mention your profile name --> click OK.
The profile page will be popped up
Choose Space only under tab policy label of the indentation tab.
Click apply and the OK.
Use Ctrl + Shift + F to format a Java class which will replace tab with space.
Eclipse Helios for C++ developers
Instead of changing the default text editor, change the Code Style/Edit -> see pictures

How do I turn off Tab and New Line markers in Eclipse?

I am using Adobe's ColdFusion Builder, an Eclipse-based IDE built on top of Aptana.
All of a sudden, I am getting a type of whitespace marker showing in my Eclipse Editor. I must have accidentally hit a key combination.
Here is a screen dump.
I have already tried "General > Editors > Text Editors > Show whitespace characters" and it is not this. I already have show whitespace characters turned off. If I turn it on, then the Whitespace Characters display over the top of what I am already seeing.
Can anyone tell me how this can be turned off? Most annoying.
Many Thanks
It's under Preferences -> General -> Editors -> Text Editors
Just uncheck 'Show Whitespace Characters':
Did you try Restarting Eclipse? If that didn't work, you might try this http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka11640.html which explains which file to delete to force eclipse to revert to use default settings.
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 + .
(that's a period by the way) 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 +
On a Mac it is Cmd +.
Hope that helps.

Ctrl Space Not Working in Eclipse Helios on Win 7

I have shifted by Dev Env recently to Eclipse Helios on Windows 7. After that the Ctrl + Space Content Assist feature is not working. I found out that that key option is utilized by Language Settings. I have tried disabling it. But it still doesn't work in Eclipse.
Any help is much appreciated.
Configure Eclipse’s content assist, go “Preferences>Java>Editor>Content Assist>Advanced“. Make sure “Other Java Proposals” is ticked.
http://www.mkyong.com/java/content-assist-ctrl-space-is-not-working-eclipse/
In my case nothing happens after pressing Ctrl+Space. Right now I have set a different short cut for the same and solved
Check your "Keys" preferences: maybe the Content Assist" shortcut has been overridden by another command which would also use Ctrl+Space.
That could happen with the installation of a new plugin, coming with its own set of commands and shortcuts: the bug 303894 for the XText plugin is a good example.
You probably have another application (in systray) that uses Ctrl+Space for something else. In my case I have a small utility which when I press Ctrl+Space makes the active window on top.
The solution for you would be to (1) exit that application which overrides the keys or (2) in Eclipse change Ctrl+Space to some other set of keys.
This was solution for me to get rid of windows key shortcuts:
Go to Start > Type in regedit and start it
Navigate to HKEY_CURRENT_USER/Control Panel/Input Method/Hot Keys
Select the key named: 00000070 for the Chinese (Traditional) IME -
Ime/NonIme Toggle hotkey 00000010 for the Chinese (Simplified) IME -
Ime/NonIme Toggle hotkey
In the right sub-window, there are three subkeys. Key Modifiers
designate Alt/Ctrl/Shift/etc and is set to Ctrl (02c00000). Virtual
Key designates the finishing key and is set to Space (20000000).
Change the first byte in Key Modifiers from 02 to 00
Change the first byte in Virtual Key from 20 to FF
Log off and log back on. I don't think it's necessary to restart.
Do not change the Hot keys for input languages in Control Panel,
unless you want to do this all over again.
https://superuser.com/questions/327479/ctrl-space-always-toggles-chinese-ime-windows-7
I have seen a similar problem in Eclipse Juno (version 4.2.0).
Since you have already tried Eclipse/Java code completion not working, I would check to see if there are any key conflicts. Go to Window -> Preference -> General -> Keys. In the filter box, replace the light gray "type filter text" with the word "Content"; the first item should be "Content Assist." Select it. It should have nothing in the Conflicts box in the lower right-hand portion of the screen.
If you have no conflicts, then it is likely that there is another program, outside of Eclipse, that is binding to Ctrl + Space.
I worked around this with an ugly solution. I copied the Content Assist. In the Binding field, I entered held down the Ctrl + Alt keys and pressed space. This restored the Content Assist function, but it required a brain remap when I am using one machine.
!Screenshot of Eclipse Juno, I had the same problem, then I changed it to different key combination, then it works.1
This is what solved my problem.
Goto Control Panel -> Clock, Language and Region -> Change keyboards or other input methods -> Change keyboards... -> Advanced Key Settings. For some reason I had ctrl + space set as Key sequence for language hot keys. I changed them to something else and rebooted.
Make sure to reboot because it did not work for me without the reboot.
On my Ubuntu, Xfce, ctrl space was allocated to switch language on the iBus preferences (if you have this running, you will see the 'i' icon on the task bar, right click and choose preferences). To change this, bring up the IBus Preferences, on the General tab, see the "Enable or disable:" option, click the ellipses and provide a different keyboard assignment.
This sorted me out without need to restart Eclipse.
I use eclipse indigo and had this problem. Creating a new workspace did not worked.
Go to Windows->preference->General->Keys->"Restore Default" - This fixed my issue
Note that I just had English(US) on windows 7 [Control Panel-> Clock,Language and Region ->Change keyboard or other input methods-> Keyboards and Languages->change Keyboards...->General ==>Default language is English and Installed Services I just had English(US) alone
After doing this some you might need to restart the system if it does not fix.
This is how I fixed my problem on Ubuntu 12.04 regardless of the eclipse version. My problem was that the ibus was overriding the shortcut so I deleted this shortcut configuration.
Type ibus in the dash:
Then select Keyboard Input Methods. From there click on the first three dots next to the Enable or disable textfield. This windows should appear:
If there is something bound to Ctrl + Space simply delete it.
#Polac - Thx. That's what fixed it for me. I'd hit ctrl+space and I'd get a popup for chinese character selection. I have Windows 7 so for me it was:
Control Panel -> Region and Language -> Keyboards and Languages tab -> Change keyboards... button -> Advanced Key Settings tab
Be warned, its stubborn. I tried to just clear them, but as soon as I applied the settings they reset back to using the original key bindings. If I change the key binding to something obscure they still reset sometimes. It's annoying. Maybe its just my OS installation that's goofed, but it could be a Microsoft bug.
Didn't need Chinese on my system, so I removed it as an installed language in the first tab and that finally got rid of the hardcoded Chinese key bindings.
In Eclipse you can use the Alt-/ character sequense instead of Control-Space. This is an old problem which Eclipse and Chinese keyboards, which they addressed by adding this short cut.
I found the answer.
Windows / UV Elements - was OFF! I don't know how but they were off. And when you click Ctrl+Space he working, but your all elements are off and you think that it is not working. You must on all UV elements and after your Ctrl + Space will be work.