adding support for splitright and splitbelow

This commit is contained in:
Xiaolong Wang 2016-03-18 14:09:14 -05:00
parent 145446b8de
commit fdd8b36e62
2 changed files with 43 additions and 12 deletions

View file

@ -35,3 +35,15 @@ module.exports = ExMode =
consumeVim: (vim) -> consumeVim: (vim) ->
@vim = vim @vim = vim
@globalExState.setVim(vim) @globalExState.setVim(vim)
config:
splitbelow:
title: 'Split below'
description: 'when splitting, split from below'
type: 'boolean'
default: 'false'
splitright:
title: 'Split right'
description: 'when splitting, split from right'
type: 'boolean'
default: 'false'

View file

@ -258,13 +258,23 @@ class Ex
filePaths = args.split(' ') filePaths = args.split(' ')
filePaths = undefined if filePaths.length is 1 and filePaths[0] is '' filePaths = undefined if filePaths.length is 1 and filePaths[0] is ''
pane = atom.workspace.getActivePane() pane = atom.workspace.getActivePane()
if filePaths? and filePaths.length > 0 if atom.config.get('ex-mode.splitbelow')
newPane = pane.splitUp() if filePaths? and filePaths.length > 0
for file in filePaths newPane = pane.splitDown()
do -> for file in filePaths
atom.workspace.openURIInPane file, newPane do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitDown(copyActiveItem: true)
else else
pane.splitUp(copyActiveItem: true) if filePaths? and filePaths.length > 0
newPane = pane.splitUp()
for file in filePaths
do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitUp(copyActiveItem: true)
sp: (args) => @split(args) sp: (args) => @split(args)
@ -335,13 +345,22 @@ class Ex
filePaths = args.split(' ') filePaths = args.split(' ')
filePaths = undefined if filePaths.length is 1 and filePaths[0] is '' filePaths = undefined if filePaths.length is 1 and filePaths[0] is ''
pane = atom.workspace.getActivePane() pane = atom.workspace.getActivePane()
if filePaths? and filePaths.length > 0 if atom.config.get('ex-mode.splitright')
newPane = pane.splitLeft() if filePaths? and filePaths.length > 0
for file in filePaths newPane = pane.splitRight()
do -> for file in filePaths
atom.workspace.openURIInPane file, newPane do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitRight(copyActiveItem: true)
else else
pane.splitLeft(copyActiveItem: true) if filePaths? and filePaths.length > 0
newPane = pane.splitLeft()
for file in filePaths
do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitLeft(copyActiveItem: true)
vsp: (args) => @vsplit(args) vsp: (args) => @vsplit(args)