🐧 Add keymap implementation to reorder tabs in linux

This commit is contained in:
Ardeshir Javaherchi
2014-11-08 15:03:36 -08:00
committed by Ben Ogle
parent 3462d99675
commit ff80545285
3 changed files with 16 additions and 0 deletions

View File

@@ -119,6 +119,8 @@ atom.commands.add 'atom-pane',
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:move-item-to-right': -> @getModel().moveItemToRight()
'pane:move-item-to-left': -> @getModel().moveItemToLeft()
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)

View File

@@ -289,6 +289,18 @@ class Pane extends Model
else
@activateItemAtIndex(@items.length - 1)
# Public: Move the active tab to the right.
moveItemToRight: ->
index = @getActiveItemIndex()
rightItemIndex = index + 1
@moveItem(@getActiveItem(), rightItemIndex) unless rightItemIndex > @items.length - 1
# Public: Move the active tab to the left
moveItemToLeft: ->
index = @getActiveItemIndex()
leftItemIndex = index - 1
@moveItem(@getActiveItem(), leftItemIndex) unless leftItemIndex < 0
# Public: Get the index of the active item.
#
# Returns a {Number}.