Skip to content
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions keymaps/vim-mode.cson
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
'ctrl-w c': 'pane:close'
'ctrl-w ctrl-q': 'core:close'
'ctrl-w q': 'core:close'
'ctrl-w H': 'vim-mode:move-pane-view-to-far-left'
'ctrl-w L': 'vim-mode:move-pane-view-to-far-right'
'ctrl-w K': 'vim-mode:move-pane-view-to-very-top'
'ctrl-w J': 'vim-mode:move-pane-view-to-very-bottom'
'g t': 'pane:show-next-item'
'g T': 'pane:show-previous-item'

Expand Down
38 changes: 37 additions & 1 deletion lib/panes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,41 @@ class FocusPreviousPaneView extends FocusAction
atom.workspace.activatePreviousPane()
@focusCursor()

class MovePane
isComplete: -> true
isRecordable: -> false
constructor: (@orientation, @pos) ->

execute: ->
rootContainer = atom.workspace.paneContainer
activePane = atom.workspace.getActivePane()
# nothing to do if there's only one pane
return if activePane.parent is rootContainer

# hack: PaneAxis is not in Atom API
PaneAxis = activePane.parent.constructor

activePane.parent.removeChild activePane

rootPane = rootContainer.root
if rootPane.orientation isnt @orientation
newPane = new PaneAxis
container: rootContainer
orientation: @orientation
children: [rootPane]
rootContainer.replaceChild(rootPane, newPane)
rootPane = newPane

rootPane.addChild activePane, switch @pos
when 'begin' then 0
when 'end' then null

activePane.activate()
activePane.getActiveItem()?.scrollToCursorPosition()



module.exports = { FocusPaneViewOnLeft, FocusPaneViewOnRight,
FocusPaneViewAbove, FocusPaneViewBelow, FocusPreviousPaneView }
FocusPaneViewAbove, FocusPaneViewBelow,
FocusPreviousPaneView,
MovePane }
4 changes: 4 additions & 0 deletions lib/vim-state.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ class VimState
'focus-pane-view-above': => new Panes.FocusPaneViewAbove()
'focus-pane-view-below': => new Panes.FocusPaneViewBelow()
'focus-previous-pane-view': => new Panes.FocusPreviousPaneView()
'move-pane-view-to-far-left': => new Panes.MovePane('horizontal', 'begin')
'move-pane-view-to-far-right': => new Panes.MovePane('horizontal', 'end')
'move-pane-view-to-very-top': => new Panes.MovePane('vertical', 'begin')
'move-pane-view-to-very-bottom': => new Panes.MovePane('vertical', 'end')
'move-to-mark': (e) => new Motions.MoveToMark(@editor, @)
'move-to-mark-literal': (e) => new Motions.MoveToMark(@editor, @, false)
'mark': (e) => new Operators.Mark(@editor, @)
Expand Down