This repository was archived by the owner on Apr 6, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 105105 ' ctrl-w c' : ' pane:close'
106106 ' ctrl-w ctrl-q' : ' core:close'
107107 ' ctrl-w q' : ' core:close'
108+ ' ctrl-w H' : ' vim-mode:move-pane-view-to-far-left'
109+ ' ctrl-w L' : ' vim-mode:move-pane-view-to-far-right'
110+ ' ctrl-w K' : ' vim-mode:move-pane-view-to-very-top'
111+ ' ctrl-w J' : ' vim-mode:move-pane-view-to-very-bottom'
108112 ' g t' : ' pane:show-next-item'
109113 ' g T' : ' pane:show-previous-item'
110114
Original file line number Diff line number Diff line change @@ -34,5 +34,41 @@ class FocusPreviousPaneView extends FocusAction
3434 atom .workspace .activatePreviousPane ()
3535 @ focusCursor ()
3636
37+ class MovePane
38+ isComplete : -> true
39+ isRecordable : -> false
40+ constructor : (@orientation , @pos ) ->
41+
42+ execute : ->
43+ rootContainer = atom .workspace .paneContainer
44+ activePane = atom .workspace .getActivePane ()
45+ # nothing to do if there's only one pane
46+ return if activePane .parent is rootContainer
47+
48+ # hack: PaneAxis is not in Atom API
49+ PaneAxis = activePane .parent .constructor
50+
51+ activePane .parent .removeChild activePane
52+
53+ rootPane = rootContainer .root
54+ if rootPane .orientation isnt @orientation
55+ newPane = new PaneAxis
56+ container : rootContainer
57+ orientation : @orientation
58+ children : [rootPane]
59+ rootContainer .replaceChild (rootPane, newPane)
60+ rootPane = newPane
61+
62+ rootPane .addChild activePane, switch @pos
63+ when ' begin' then 0
64+ when ' end' then null
65+
66+ activePane .activate ()
67+ activePane .getActiveItem ()? .scrollToCursorPosition ()
68+
69+
70+
3771module .exports = { FocusPaneViewOnLeft, FocusPaneViewOnRight,
38- FocusPaneViewAbove, FocusPaneViewBelow, FocusPreviousPaneView }
72+ FocusPaneViewAbove, FocusPaneViewBelow,
73+ FocusPreviousPaneView,
74+ MovePane }
Original file line number Diff line number Diff line change @@ -142,6 +142,10 @@ class VimState
142142 ' focus-pane-view-above ' : => new Panes.FocusPaneViewAbove ()
143143 ' focus-pane-view-below ' : => new Panes.FocusPaneViewBelow ()
144144 ' focus-previous-pane-view ' : => new Panes.FocusPreviousPaneView ()
145+ ' move-pane-view-to-far-left ' : => new Panes.MovePane (' horizontal' , ' begin' )
146+ ' move-pane-view-to-far-right ' : => new Panes.MovePane (' horizontal' , ' end' )
147+ ' move-pane-view-to-very-top ' : => new Panes.MovePane (' vertical' , ' begin' )
148+ ' move-pane-view-to-very-bottom ' : => new Panes.MovePane (' vertical' , ' end' )
145149 ' move-to-mark ' : (e ) => new Motions.MoveToMark (@editor , @ )
146150 ' move-to-mark-literal ' : (e ) => new Motions.MoveToMark (@editor , @ , false )
147151 ' mark ' : (e ) => new Operators.Mark (@editor , @ )
You can’t perform that action at this time.
0 commit comments