How to trigger Eclipse-like cmd+click in IntelliJ? - intellij-idea

How do i trigger the cmd + click behaviour (Go to Class, go to declaration etc) in IntelliJ when my current keymap uses Eclipse (MacOS)?
I'm currently switching from Eclipse/STS to IntelliJ. So far, i've changed the keymap to use Eclipse (MacOS), so most of the familiar keyboard shortcuts i use still works.
control + click does the functionality that i want using Eclipse (MacOS) keymap but this also triggers system behaviour of right click, so menu pops out the same time that the go to class/variable triggers. Is there a way i can set or use cmd + click to trigger the desired behavior?

Go to Preferences > Keymap.
You have to copy the Eclipse (MacOS) keymap to a new name, in order to make changes: select the Eclipse (MacOS) keymap, press the Copy button and give it a new name, e.g. Eclipse (MacOS) 2.
Then click into the filter field, enter declaration, then in the tree area do right-click on the Main menu > Navigate > Declaration line in order to activate the context menu. The result should look like this:
Select Add Mouse Shortcut from the context menu, a dialog opens. Perform into this dialog the key + click combination you wish to add, in your case cmd + click:
Confirm the new Mouse shortcut with Ok, then close the Preferences dialog also with Ok or Apply. Done.
Note: you can delete the ctrl + click mouse shortcut, if you wish to not use it by mistake, by selecting Remove ^Button1 Click in the context menu.

Related

How to check/uncheck individual change checkbox in IntelliJ commit diff dialog?

I am an aspiring keyboard user, using IntelliJ to do selective commits to my project.
To do this, I open the Commit dialog with Ctrl+K.
I then press Shift+Tab to switch to the file list, Home to select the root-level node, and Space to uncheck/de-select all files.
I then press the down arrow once or more to select a file, press Ctrl+D to display its diff. I press F7 to go to the first change in the file.
At this point, to the left of the right pane (with the new version of the file) is a checkbox. Not the one at the top which selects all the changes in the file, but the one which selects just the change displayed.
My question is: How do I select/un-select this checkbox without using the mouse cursor? I need to use the mouse as little as possible due to RSI.
Note: When asking questions like this, I sometimes get responses with other pointing device suggestions. Unless you're going to recommend a keyboard technique, I am not interested in your suggestion, and will flag/report your response if that's what it is.
By default there is no keyboard keymap for this action. But you can easily choose new keymap for this.
Go to File->Settings and search for "include" in the search box. What you need is to assign a keymap for "Include Lines Into Commit". Double click on this option and assign any keymap that you want. It is hard to find new keymap that didn't assign to any other action, but only for the demo I choosed Ctrl+T.
You can see what I did in the following image:
Click on Apply and then you can use the keymap that you choose to check/uncheck any individual change checkbox in Intellij commit diff dialog.

How to add a Stop icon to NetBeans 8.2

On mac in NetBeans 8.2 I have a panel with a run button.
It's a bit strange to me after Visual Studio that there is no Stop button there. Is there a simple way to add it?
It should do the same as Shift+command+fn+delete or Stop Build/Run
It's a bit tricky to restart it every time to test my changes.
I don't think it is possible to easily do what you want.
The only place the Stop icon/button appears in NetBeans is in the Output window, and that is not available for reuse elsewhere, so NetBean's View > Toolbars > Customize functionality won't be of any use.
However....it is trivial to specify a shortcut key for the action associated with the Run > Stop Build/Run menu entry:
In NetBeans select Tools > Options
Click the Keymap icon. All the actions will be listed, along with their shortcuts.
Type Stop in the Search field to locate the Stop Build/Run action.
For the listed action named Stop Build/Run click the ellipsis and select Edit... from the popup menu.
The cursor will move to the Shortcut field. You can now select any available shortcut. For example, in the screen shot below I pressed the ALT key, and then selected ALT+T from the drop menu of available shortcuts.
Then, you can just submit ALT-T from the keyboard to terminate a running application, instead clicking the Stop button in the Output window, or selecting Run > Stop Build / Run.
I know that you were asking for a toolbar solution, but in the absence of one perhaps a keyboard shortcut is a viable alternative.

Shortcut to Close Intellij File Tab

I love intellij's file tab but I can't seem to find a way to shortcut closing a tab similar to the behavior of ctrl + w in chrome. I can't find the option in the keymap editor. Am I missing something or is this not implemented?
I found this page but it doesn't include the action name. I would use ctrl + f4 but my window manager has that reserved and I would rather change it.
Open Settings by hitting Ctrl+Alt+S
Click: Keymap
Search for: Close
Under Main menu > Window > Editor Tabs, find Close.
Right-click and click Remove Ctrl+F4.
Right click and click Add Keyboard Shortcut
Add your new custom Keyboard Shortcut.
IntelliJ will tell you if the shortcut clashes with another shortcut performing a different action.
Alternatively, open/edit your Linux Window Manager Settings and remove the Ctrl+F4 mapping to allow other programs like IntelliJ to make use of it.
For PC-based keyboards, the shortcut to close tabs is CTRL + F4,
not to be confused with ALT+F4.
Current tab can be closed with:
Ctrl + F4
Works on Intellij Ultimate 2016.3
On mac OS, Intellij 2018.3 version, 'Command + W' does close the file tab.
As we can see in the image in this discussion:
Go in Settings >> Keymap >> Main menu >> Other >> [Close Active Editor] and change to Ctrl+W.
I'm on version 2020.1 and this has changed to Ctrl+4

Choose between open declaration/implementation on Ctrl + click in IntelliJ IDEA

Details:
IDE: IntelliJ IDEA 14
O.S.:: Windows 7
If I want to navigate to the declaration of a method I can choose one of the following approaches:
press Ctrl + left click
right click > Go To > Declaration
press Ctrl + B
If I want to navigate to the implementation of a method I can choose one of the following approaches:
press Ctrl + Alt + left click
right click > Go To > Implementation(s)
press Ctrl + Alt + B
In Eclipse, if I press Ctrl and the mouse is over a method, a popup appears and I can choose what to do (go to Implementation/Declaration). If I press "left click" ( Ctrl is still pressed ) the first option will be chosen.
How can I achieve the same / a similar behavior in IntelliJ IDEA ?
There is not a built-in option for this. You would need to configure a custom quick list to do such.
Open the Settings dialog and go to "Quick Lists" (It's under "Appearance & Behavior" in IDEA 14)
Click the add button to the right of the middle pane
Give your list a name
Click the add button to the right of the far right pane (where is reads "no actions")
Add the Go to Declaration action (Main Menu > Navigate > Go to Declaration)
Add the Go to Implementation(s) action (Main Menu > Navigate > Go to Implementation(s))
Click Apply
Go to Keymap in the settings
Under the "Quick List" node, find the Quick List you just created and map a short-cut (keyboard or mouse) to it. You can, of course, remap one of the shortcuts used by the Go to Declaration or the Go to Implementation(s) action
Click OK to close out of the settings and give it a try.
Note that in the quick list that opens, you will have numbers next to each action for quick selection.
Edit:
Adding a screenshot of final quick list for additional clarity
I was looking for the same thing, because I was also used to it in Eclipse. Nevertheless, in 99% of the cases, I went to the implementation. If that's your case too, you may consider changing the Ctrl+click shortcut in IntelliJ:
Open File → Settings... → Keymap
Search for "implementation", and identify the item "Main menu → Navigate → Implementation(s)" in the list
Right-click the item and choose "Add Mouse Shortcut"
Add the Ctrl+click shortcut by making a Ctrl+left click on the window
When hitting the OK button, you have two choises :
Remove the existing shortcut (opening the declaration)
Leave the existing shortcut : In that case, when using then Ctrl+click, both the declaration and the implementation will be opened (at least when they are in different files)
I know this answer comes like 2 years too late, but hopefully it may help others?
EDIT : This shortcut also applies when you want to navigate to the declaration of a super class. Therefore, my "99%" first declared above drops a bit.
I've added the ctrl + right-click as a shortcut to go the declaration (which conflicts with no other shortcut - but you need a mouse with at least two buttons...).
If you select the method and hit Ctrl+T it will show the implementations of the methods. You can click on the options to navigate to that implemented method. Hope this helps.
On mac you can open the implementation(s) with command + option + click. Right -click on the method and check "go to" for the other options and shortcuts you might need.
My IntelliJ (2016.2) shows the declaration of a method (in a PHP interface) as one of the implementations in the implementation popup, so maybe you can do this all from the Implementations popup now.

Change intellij/android studio tool window quick access shortcuts

Is it possible to change the quick access shortcut numbers for a tool window?
i.e. the numbers next to a tool window name, used by the keyboard shortcut to toggle the window, talked about here
Yep. They are listed in Keymap. MainMenu -> View -> ToolWindows.
P.S.: Idea has a nice Find by shortcut function in Keymap settings page, I used it, to answer your question.
In Android Studio, you can change the Keymap this way:
Preferences -> Keymap
Then open Tool Windows. You may need to scroll down to see all the options.
Right-click on the element you want to assign a new key-stroke. Select Add Keyboard Shortcut. Make sure that the rectangle with a plus in it is selected (use your mouse) and press the key-stroke that you want for this item.
Android Studio will warn you if that key-stroke is already assigned. Click OK to reassign that key-stroke to the item. It'll warn you one more time that you will need to remove the previous assignment for that key-stroke. Click Remove to proceed. You should see the updated keystroke in the right-most column.