-->

Intellij: Move tab left and right

2020-08-09 07:09发布

问题:

Is there a way to move/reposition a tab using the keyboard? I know I can switch tab using ALT + LEFT/RIGHT, and I would like to be able to move them maybe using ALT + SHIFT + LEFT/RIGHT.

Is this possible?

回答1:

There is no built-in keyboard shortcut for this functionality as of the latest 2017 build.

You can vote for it in the issue tracker though.



回答2:

I'm not sure if you can move the actual tabs. However if you use CTRL + TAB you get the same functionality you would see by doing ALT + TAB on Windows.

Meaning you can hold the key combination to find a tab you want to quick swap with, and then just press the key combination to switch back and forth.



回答3:

My research suggests there's no way to do this (currently). There is a "Move Right" and a "Move Down" but that just splits the tab groups vertically and horizontally, respectively. There's no key binding that seems related to this, either.

Perhaps suggest it as a feature: https:// youtrack.jetbrains.net /issues/IDEA/ (they have a bad cert so I don't want to link directly)


There's a plugin for this that you can install: http://www.smardec.com/products/idea.html

Unfortunately, it doesn't work in Intellij 13 (gives runtime errors)



回答4:

The plugin TabMover has been working for the past few years in WebStorm. (Confirmed January 2019)

You can install it directly from Preferences > Plugins. Just search for TabMover

On MacBooks the default keybindings are Cmd-Opt-Shift-Left/Right.

But you can remap them to Ctrl-Fn-Shift-Up/Down if you want.

Under Preferences > Keymap search for Move Tab To Previous and Move Tab To Next

(Incidentally, if you want the same behaviour for tabs in Google Chrome, I can recommend the extension Keyboard Shortcuts to Reorder Tabs. Firefox works out-of-the-box!)



回答5:

My workaround for this is to set keyboard shortcuts in IntelliJ for

  1. Move to opposite group
  2. Move right

What these keyboard shortcuts do: Move to opposite group: (moves your tab to the other tab is the window is already split. Does nothing if there is no split tab.) Move right: (this splits the current tab in half, and moves your current tab to the other half) So, when there are no tabs, use the keyboard shortcut for move to right, and if there is one already, use move to opposite group.

To set keyboard shortcuts, open settings (Ctrl + Alt + S), and go to Keymap. Just search for "move right" or "move to opposite group"

I set mine to ctrl+numpad7 and ctrl+numlock respectively.



回答6:

There is a plugin for this since a while back:

https://plugins.jetbrains.com/plugin/8443-a-move-tab-left-and-right-using-the-keyboard-plugin--by-momomo-com



回答7:

Ok so this is an old post but in Pycharm 2018 you can create a macro to move a tab left or right and assign a keystroke combination to it. Edit>Macro>Start macro recording



回答8:

By default, it seems that Alt+Right/Alt+Left is now doing the job: https://www.jetbrains.com/help/webstorm/using-code-editor.html

For me, I use Alt+Left / Alt+Right to navigate through locations. So I have set Alt+Ctrl+Left/Alt+Ctrl+Right to move between tabs.