Control-M -> ENTER in Eclipse - eclipse

Is it possible in Eclipse to assign Control-M key to newline?
Windows XP + Helios.

I don't know for sure, not having done it myself, but investigate the key binding dialog Window > Preferences > General > Keys. See page 362 of the 3.1 documentation for more.

In Window > Preferences > General > Keys,
redefine Insert new line Below current line, and Bind Ctrl+M.
Be careful, by default, Control-M already toggles maximize/restore state of active view or editor. this will override the shortcut.

Related

Eclipse Ctrl+Shift+D not working With Pydev

When Using Pydev on Eclipse, I wanted to bind Ctrl+Shift+D Copy Lines and Ctrl+D to Delete line. But when I do so, the Ctrl+Shift+D doesn't work.
I removed all the other bindings of Ctrl+Shift+D but it doesn't work.
Fun fact, if I choose Ctrl+Shift+C, it does work, so I'm wondering where is this key binding used.
The problem arrises only in Pydev, ie. when I open the file in Text editor the bindings work.
This was fixed for PyDev 6.3.3.
The problem was that there was a command bound to Ctrl+Shift+D which was not visible there because it wasn't properly categorized.
I fixed this in: https://github.com/fabioz/Pydev/commit/422a0bde1d1a3ac5c091c00e88368a3bc3c0dc5f
Note that you could still override it if at the keybindings dialog you created a command and put the 'When' as 'PyDev editor scope' (which defines when it's active -- it wouldn't work without this because the hidden action had a higher priority given that its scope was narrower).
See details at: https://www.brainwy.com/tracker/PyDev/906

Shortcut for joining two lines

What's the keyboard shortcut for joining two lines in VS Code?
If the cursor is anywhere in the first line of
f(foo,
bar)
then when I hit the shortcut, I want to get
f(foo, bar)
Visual Studio Code now comes with a default key binding for joining lines, Ctrl + J.
You can find all keyboard shortcuts under Preferences > Open Keyboard Shortcuts.
You can overwrite it using the UI or by providing a different key combination for the command editor.action.joinLines in keybindings.json.
Press F1, and type Join Lines. By default there is no key bindings to it yet, but you can easily set it under 'Preferences > Keyboard Shortcuts', then search for Join Lines and set a shortcut.
You can simply:
Select the lines to be joined.
Hit Ctrl+Shift+P or F1.
Type join lines.
Since the best way is already answered I'm just adding an alternative.
If you want to work with defaults you can hit Ctrl+Del while caret is at the end of the first line.
Works with multi-select too if you want to join multiple lines.
Depending on how much clutter you have in your , try the following "keypress sequence" (you must have focus in an open editor tab for this to work1, and make sure to have your cursor/lines selected before doing this):
Ctrl+Shift+P JL 2
If your Command Palette ends up showing a clash of non-Join Lines entries when you finish typing, you may have to end up typing instead3:
Ctrl+Shift+P JOINSpace L
Ctrl+Shift+P JOINSpace LI
...
Ctrl+Shift+P JOINSpace LINES
...Manually select from the Palette using down arrow or mouse 4
In case you're thinking about setting your own keybind (since it is unset by default in Windows), here are the other Commands that have a keybind associated with them containing a J 5:
Command
Keybinding
When
workbench.action.search.toggleQueryDetails
Ctrl+Shift+J
inSearchEditor || searchViewletFocus
View: Toggle Panel
Ctrl+J
---
Unfold All
Ctrl+K Ctrl+J
editorTextFocus && foldingEnabled
Notebook: Join With Previous Cell
Shift+Alt+Win+J
notebookEditorFocused
Notebook: Join With Next Cell
Alt+Win+J
editorTextFocus && foldingEnabled
I suggest using Ctrl+Alt+J or Ctrl+Shift+Alt+Jif you end up going this route, since it doesn't seem to clash with existing defaults and is similar to what people are already used to.
Alternatively, if you tend to use a different text editor or IDE,
[File > Preferences > Keymaps] (Ctrl+K Ctrl+M) offers a selection of alternative keymaps (these are extensions, which must be installed), including (as of now, sorted by current rating):
IntelliJ IDEA (by Keisuke Kato)
Sublime Text (by Microsoft)
Atom (by Microsoft)
Eclipse (by Alphabot Security)
Visual Studio (by Microsoft)
Delphi (by Alessandro Fragnani)
Notepad++ (by Microsoft)
Vim (by vscodevim)
Emacs (by hirosun)
1 In other words, don't be in a "non-editor" window like Settings or Keyboard Shortcuts
2 Alternatively, Command Palette can also be opened by selecting [View > Command Palette...] instead of Ctrl+Shift+P
3 This could occur due to having 3rd-party Commands containing the letters j and l. Command Palette can also be found alternatively by selecting [View > Command Palette...]
4 Hopefully you don't end up with this case.
5 These are all listed under [File > Preferences > Keyboard Shortcuts] (Ctrl+K Ctrl+S)

Cmd+I does not work in Java Perspective in Eclipse?

I'm using Eclipse 4.4.1 on Mac OS X 10.10.2. Menu File > Properties has a hotkey Cmd+I. But pressing that does not bring up the same window showing the properties of the .java file open in the editor window. Any ideas?
BTW, do people have a sense if SO is any better than than https://eclipse.org/forums/ for getting quick replies?
In the Java editor Cmd+I is bound to the 'Correct Indentation' command, this takes precedence over the Properties binding when you are in the editor.
Look in 'Preferences > General > Keys' to see the key bindings. Click on the 'Binding' column to sort by the key binding to see all the bindings for a key together.

What is the Auto-Alignment Shortcut Key in Eclipse?

What is the auto-alignment shortcut key in Eclipse?
Ctrl+Shift+F to invoke the Auto Formatter
Ctrl+I to indent the selected part (or all) of you code.
Auto-alignment? Lawful good?
If you mean formatting, then Ctrl+Shift+F.
The answer that the OP accepted is wildly different from the question I thought was asked. I thought the OP wanted a way to auto-align = signs or + signs, similar to the tabularize plugin for vim.
For this task, I found the Columns4Eclipse plugin to be just what I needed.
Want to format it automatically when you save the file???
then Goto
Window > Preferences > Java > Editor > Save Actions
and configure your save actions.
Along with saving,
you can format, Organize imports,add modifier ‘final’ where possible etc
auto-alignment shortcut key Ctrl+Shift+F
to change the shortcut keys Goto Window > Preferences > Java > Editor > Save Actions

How to modify the keyboard shortcuts in Eclipse IDE?

Title more or less says it all. Specifically, I've become increasingly annoyed that in order to run an ant script I have to use Alt+Shift+x, q. But I think If I had this power I would many things I would change the shortcuts for/add shortcuts for things that don't currently have them.
Window > Preferences > General > Keys
In particular, edit the "Run Ant Build" command.
For Windows:
Window > Preferences > General > Keys
For mac that would be
Eclipse > Preferences > General > Keys
Pressing Ctrl + Shift + L will open the current list of defined shortcuts, again pressing Ctrl + Shift + L will open preference page from where the shortcuts can be modified.
As a side note make sure your newly mapped Shortcut won't have any conflicts on the right of the Keys window/menu.
If so choose a combination that will work; doesn't have any conflicts with existing ( default ) settings.
Hope this helps.