adding support for splitright and splitbelow

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

View file

@ -35,3 +35,15 @@ module.exports = ExMode =
consumeVim: (vim) ->
@vim = 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,6 +258,15 @@ class Ex
filePaths = args.split(' ')
filePaths = undefined if filePaths.length is 1 and filePaths[0] is ''
pane = atom.workspace.getActivePane()
if atom.config.get('ex-mode.splitbelow')
if filePaths? and filePaths.length > 0
newPane = pane.splitDown()
for file in filePaths
do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitDown(copyActiveItem: true)
else
if filePaths? and filePaths.length > 0
newPane = pane.splitUp()
for file in filePaths
@ -266,6 +275,7 @@ class Ex
else
pane.splitUp(copyActiveItem: true)
sp: (args) => @split(args)
substitute: ({ range, args, editor, vimState }) ->
@ -335,6 +345,15 @@ class Ex
filePaths = args.split(' ')
filePaths = undefined if filePaths.length is 1 and filePaths[0] is ''
pane = atom.workspace.getActivePane()
if atom.config.get('ex-mode.splitright')
if filePaths? and filePaths.length > 0
newPane = pane.splitRight()
for file in filePaths
do ->
atom.workspace.openURIInPane file, newPane
else
pane.splitRight(copyActiveItem: true)
else
if filePaths? and filePaths.length > 0
newPane = pane.splitLeft()
for file in filePaths