Keyboard shortcut to close active file tab?!

Answered

I'm using Eclipse shortcuts and I hit Ctrl+W to close the file tab I'm looking at but it collapses the Project window, and I go to Keymap settings and there's nothing I recognize there as to close the active file tab.

10
22 comments
Official comment

Hi,

 

You can customize your shortcuts. By default ctrl+w goes for "Extend Selection". You can assign this combination under Settings > Keymap > Main menu > Window > Editor Tabs > Close (Alt+f4 by defaul).

 

Thanks!

Hi there,

On "Settings/Preferences | Keymap" look for "Main Menu | Window | Editor Tabs | Close" action and assign any desired shortcut.

From what I see the default shortcut for this action using Eclipse keymap is Ctrl+F4

5

It would also be nice if CTRL+W closed a tab in the Editor window. Or if there was some keyboard shortcut to closing a tab. Every time I have to touch my mouse when coding, a part of me dies a little. ;)

Please, someone either tell me how to do this, or please add this enhancement to TOAD. Most Windows applications use CTRL+W to allow for the closing of the active file or tab.   

6

Hmmm, I'm with acemary mary and have been trying to get ctrl-w to work. Currently it's the second short-cut assigned to close active tab but doesn't work. Any ideas why not?

3

Screenshots please.

So far it sounds like you assigning that shortcut to a wrong action ... or there is another action for that shortcut which cancels yours.

0

Oops! You were right, sorry: I confused "close" and "close active tab", apparently. I assigned ctrl+w to "close" and now it does what I want.

 

1



I can't get this working. The only close active tab that exist is for active tool window, and that closes the project view. How do you set it up to close the active editor tab? 

0

>How do you set it up to close the active editor tab? 

Just assign shortcut to the correct action

PhpStorm 2017.1.4 on Windows 10:

6

Thank you for the clarification. I would never have came up with the idea to search for Close Active Editor, even if i had seen that one i would not associate it to closing the current tab i am on.

 

2

Well .. that's "more correct" / dedicated action.

The one in my first comment (and one in the comment with "official" label) still works fine. It just that it has small downside (which you may never face or notice it) -- it can also close "other" tabs not just Editor ones (e.g. tabs in Search Results etc).

0

I think Jetbrains should reconsider this default. (I use IntelliJ Ultimate and have the same problem). If you have a tabbed interface, ctrl+w is pretty much expected to close the current tab. If not, it is supposed to close the current "W"indow. Browsers are prime example of doing this right.

Also, what Endasil did above makes perfect sense. It should have done what "Close Active Editor" mapping do, what other purpose it serves?

Thanks!

5

There's been a lot of discussion about that, but the platform team decided to keep things intact.
https://youtrack.jetbrains.com/issue/IDEA-118942

-3

Wow, this is as binary as it gets. I understand making bad decisions but not acknowledging it or getting anchored to them for backward compatibility is worse.

2

I didn't read https://youtrack.jetbrains.com/issue/IDEA-118942 and I won't.

The decision is blatantly wrong because an editor is not a tab.

"Close Active Editor" should do as it says and close the editor tool, with all tabs in it.

Since it just closes a tab this is an error, by the grammatical pow, by the user interface pow, and it is also against a universally standardized behaviour.

0

Changing the "Keymap" from "Mac OS X" to "Mac OS X 10.5+" makes Cmd+W close editor tabs.

Currently using RM 2018.1.4.

2

I too would really, really like this to be fixed.  If backwards compatibility is the problem, perhaps you can do something as with Mac and introduce a new keymap.  My platforms: Debian & Ubuntu.  When I must: OSX.

0

By the way, Steve Jobs got this one right :-)   http://laydros.freeshell.org/docs/stevekeys.html

0

Window > Editor Tabs > Close works when navigating via the top menu on windows in webstorm 2019.3

I assigned Keymap to do the same and it does NOT work 

0

Brian Mackey, I have just tried to assign "Ctrl+W" to this action and it works like a charm to me.

Is there any chance that you have left "Extend selection" on "Ctrl+W" as well? Could you please show a screenshot from keymap setting?

0

Aaaaaaaaaaaaahhhhhhhhhhhhh! This is so annoying!

Sorry, just had to vent.

1

I've spent far too long trying to get this working.  I've removed Ctrl+W from extend selection.  I have the setting above and it still won't close the active editor tab! I don't mind @Bazanov's "downside" in fact that might be useful.  But Ctrl-W still does nothing!  Windows 10, 2020.3.

The shortcut doesn't show up in the menu:

I figured it out, I was typing in an "abbreviation" whatever that is, I should have selected "add keyboard shortcut". Now I admit that is my stupidity, but whoppee after 2 years of using PHP Storm I finally have CTRL-W !!!!!

0

As to backward compatibility behavior, perhaps just add  "Close Active Editorsalong side "Close Active Editor". 
As to changing the default keybind, I would also like this but have to say I think people are being a little quick to judge here.

I tried to find another suitable combination and it is a bit of a problem.
Largely because CNTRL+W and CNTRL+SHIFT+W work together to expand/shrink a selected phrase.

So, to give expand/shrink selection users a fair alternative you have to find a new home for those bindings. Problems with that:

  • You would need to rebind TWO defaults to do the reverse action for the SHIFT case, not just CNTRL + W
  • So that also rules out rebinding Expand Selection to CNTL+SHIFT+W as the default for the old action
  • CNTRL + Z, X, C, V, A and S are all taken by extremely standardized bindings (undo, cut, copy, paste, select all, save)
  • Q, E and D all have editor functionality bound to every possible combination of CNTRL SHIFT button already
  • No other keys are as accessible to the left CNTRL/CMD button except TAB, CAPS, accent/tilde, 1, 2 and space
  • Numeric keys arguably should not be bound by default, all the others are bound already except CAPS which...ya

Given all that drama, I can understand CNTRL + F4

0

Please sign in to leave a comment.