Duplicate Tab


#1

So Chrome has this essential feature “duplicate tab” feature where I can right-click on a tab and then it makes an exact copy of that tab.

It would be great if this could be added to atom.

My current workaround is to first split the tab to create a copy of it, then drag and drop the new tab into the old pane, then delete the empty new pane. But this takes way too long to be usable.

This would also be a tremendous help when searching. Currently when I click on a search results that exists in an open tab, the cursor will jump to the existing tab and change position to highlight the search result. This can be very frustrating if I was editing that file. By duplicating the tab before hand, I can have the “jump to search results feature” and keep my original edit point.

As a side note, double clicking on search results is way too disruptive currently, it changes the open files, it changes cursor positions in open files, etc… the duplicate tab feature would be one step closer to alleviating this problem.


#2

This is very easy to do via the API and an init.coffee script:

atom.commands.add 'atom-workspace', 'custom:duplicate-tab', ->
  firstPane = atom.workspace.getActivePane()
  itemIndex = firstPane.getActiveItemIndex()
  secondPane = firstPane.splitRight({copyActiveItem: true})
  secondPane.moveItemToPane(secondPane.getActiveItem(), firstPane, itemIndex + 1)

Then just add a keybinding in keymap.cson:

'*':
  'ctrl-t': 'custom:duplicate-tab'