Shortcut to Close Intellij File Tab - intellij-idea

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

Related

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

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.

Shortcut for locate current file in Project Explorer in IntelliJ?

I read this post:
Locate current file in IntelliJ
Still the problem is that I do not want to have Autosccroll from Source enabled because my Project Explorer will be jumping up and down. Rather I need a shortcut to locate the current file in the Project explorer when I need to. ALT + F1 does work but you need to select from a context menu where you would like the file to be shown. In Resharper for example the shortcut is ALT+SHIFT+L but I am not able to find such a shorcut in IntelliJ?
There is no shortcut for this action in IntelliJ IDEA other than Alt-F1.
There is no default way of doing this.
I can think of 4 options:
You can install the plugin 'Scroll From Source' which will allow you set such a shortcut in the keymap settings (Default: Meta + Ctrl + S)
Use the target symbol in the project explorer, no shortcut but is default option.
Get used to having to press Alt + F1 and then Enter
Record a macro for the above key presses but this may be unreliable. You could then assign a shortcut key to play this marco.

Where is "close diff window" in Intellij keymap and/or menu

There is a bug in latest intellij that "escape" no longer closes popup "diff" windows such as
compare to clipboard
compare with Git
show History
I would like to do a workaround by closing the window via something like Option-F4 or Control-W. But where is the Keymap entry for closing these windows? I have searched on close and there is no entry.
The last fallback is to go the snail way - to mouse over to click on the red "close window" button: but any mouse movements are slower than a keyboard shortcut.
Updated information Note: the normal "close window" keys (i am on Mac) do not work.
Here is the IJ bug entry https://youtrack.jetbrains.com/issue/IDEA-142932
Another update Here is key bindings: notice there is NO Close Editor Tab instead only Close All
I'm using OS X Yosemite and pressing Cmd + F4 has the desired effect of closing the window. Cmd + F4 is bound to Window / Editor Tabs / Close.
The short answer:
The related key binding is "Close" under "Editor Tabs" menu,
Then you can customize the keyborad shortcut as you want.
File > Settings > keymap >

Intellij IDEA: Hotkey for "scroll from source"

I can't find a hotkey for the feature "Scroll from Source".
What is the difference between Scroll from Source and Scroll to Source as well?
In the latest IntelliJ IDEA, there is a keymap entry called "Select in Project View" with no default shortcut. Just add a shortcut key to it. No need for a plugin.
tldr;
Alt + F1, then 1
First checkout your shortcut key for the "Select In.." item in the Navigate menu.
Click in the file you're editing, hit the shortcut key for "Select in".. then press 1.
I've changed the hotkey for select in to Alt + 1 so that my key combination is the easy to remember Alt + 1, 1
There is a plugin for this now.
It's called Scroll From source:
https://plugins.jetbrains.com/plugin/7606?pr='
This is now builit in see #Dimitrov answer
https://stackoverflow.com/a/42025214/961018
There's no configurable shortcut in the Keymap settings, and it does not appear in the "Enter action" dialog, so I'm pretty sure it's not (yet) configurable, even if I agree it would be very appreciable.
You can use the navigation bar Shortcut keys as well.
On Mac
Hit ⌘ + ↑ (command and up key)
Hit ← (left arrow)
Hit ⌘ + Enter
This will take you to the folder in project view.
It's worth having a play round with the navigation bar.
IntelliJ really have this covered :)
For ubuntu i did ALT+L (cause ALT + F1 is busy), then just enter.
If you are using JetBrains Rider, then the shortcut is Locate in Solution Explorer:
As a much much much much much better alternative to the scroll from source functionality you can use the Navigation bar.
Note: double clicking on the folder in the navigation bar will scroll to that folder in the Project view, (i.e. the same functionality as scroll from source).
You can show the navigation bar in the view menu, there's also a shortcut for each OS (cmd and up arrow ⌘ + ↑ on OSX, Alt + Home on Linux and Windows)
So it looks like this...
And it allows you to browse through the folder structure containing the file in focus in the main editor.
https://www.jetbrains.com/phpstorm/help/navigation-bar.html
https://www.jetbrains.com/idea/help/navigation-bar.html
https://www.jetbrains.com/webstorm/help/navigation-bar.html
In Ubuntu 18 you can disable shortcut Alt+F1, the super key(windows key) do same thing.
At moment i disable/changed this shortcuts of ubuntu
Alt+F7 --> windows+F7
Ctrl+Alt+L --> windows+L
Alt+F1 --> windows
Another better way:
The Shortcut is called Select in Projec View
The default shortcut is
CTRL+Alt+1
or you can edit this.
Source: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206717285-Scroll-from-source-keyboard-shortcut-?flash_digest=77b77d09d61eff96f7d59697820dee45b2c2041c
UPDATE: Now you can easylly use Shift+Alt+1 in Gnome Keymap or Alt+F1 in Windows Keymap
Blockquote
If I understand correctly you don't want to toggle the option so much as trigger the file browser tool window with the selection being the currently edited file.
Just leave 'Scroll From Source' enabled and open the file browser with Command + 1 on OSX or CTRL + 1(i think) on Windows. The file browser sidebar will be selected and your selection will be highlighted.
This answer also explains the difference between Scroll To and Scroll From: How to make Scroll From Source feature always enabled?
In JetBrains Rider, this action used to be named Locate in Solution Explorer, but is now (v2019.2) named Locate/Select in Solution View and by default (at least with the built-in ReSharper keymap) bound to Alt+Shift+L.

How / can I display a console window in Intellij IDEA?

Is it possible to have a console window / command-line interface as part of the Intellij IDEA UI? I'd rather go command-line for certain actions, like working with GIT or kicking off build-processes, but at the moment that means keeping a separate console window open and alt-tabbing.
Is there some form of integrated console? And even better than that, can it automatically point at my project root by default?
IntelliJ IDEA 14 & 15 & 2017:
View > Tool Windows > Terminal
or
Alt + F12
In IntelliJ IDEA 2016.1.1:
View->Tool Windows->Debug (Alt+5)
on top right of Debug Window, click "Restore Console View" which is only show a icon like below:
More IntelliJ 13+ Shortcuts for Terminal
Mac OS X:
alt ⌥F12
cmd ⌘shift ⇧A then type Terminal then hit Enter
shift ⇧shift ⇧shift ⇧shift ⇧ then type Terminal then hit Enter
Windows:
altF12 press Enter
ctrlshift ⇧A start typing Terminal then hit Enter
shift ⇧shift ⇧ then type Terminal then hit Enter
View>Tool Windows>Run
It will show you the console
UPDATE: Console/Terminal feature was implemented in IDEA 13, PyCharm 3, RubyMine 6, WebStorm/PhpStorm 7.
There is a related feature request, please vote. Setting up an external tool to run a terminal can be used as a workaround.
Hover to the sidebar and select the "Restore visual elements of debugger..."
Press the left corner button
Choose debug
Click console
I use Shift + F12 to show the Console again (or Window > Restore Default Layout).
To enable that, I have previously saved the layout WITH the console open as default (Window > Store Current Layout as Default).
IntelliJ IDEA 2018.3.6
Using macOS Mojave Version 10.14.4 and pressing ⌥F12(Alt+F12) will open Sound preferences.
A solution without changing the current keymap is to use the command above with the key fn.
fn ⌥ F12(fn+Alt+F12) will open the Terminal. And you can use ShiftEsc to close it.
On IntelliJ IDEA 2020.2.1
Click on the tab that you want to open as window mode.
Right-click on the tab name and select View mode > Window