From b763104cb23ce070bd09cf8c815242e87abbff4d Mon Sep 17 00:00:00 2001 From: Xiaolong Wang Date: Fri, 18 Mar 2016 14:09:14 -0500 Subject: [PATCH] adding support for splitright and splitbelow --- lib/ex-mode.coffee | 12 ++++++++++++ lib/ex.coffee | 43 +++++++++++++++++++++++++++++++------------ 2 files changed, 43 insertions(+), 12 deletions(-) diff --git a/lib/ex-mode.coffee b/lib/ex-mode.coffee index e3a15b2..490003e 100644 --- a/lib/ex-mode.coffee +++ b/lib/ex-mode.coffee @@ -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' diff --git a/lib/ex.coffee b/lib/ex.coffee index 41aaed6..c0ae5fd 100644 --- a/lib/ex.coffee +++ b/lib/ex.coffee @@ -258,13 +258,23 @@ class Ex filePaths = args.split(' ') filePaths = undefined if filePaths.length is 1 and filePaths[0] is '' pane = atom.workspace.getActivePane() - if filePaths? and filePaths.length > 0 - newPane = pane.splitUp() - for file in filePaths - do -> - atom.workspace.openURIInPane file, newPane + 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 - 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) @@ -335,13 +345,22 @@ class Ex filePaths = args.split(' ') filePaths = undefined if filePaths.length is 1 and filePaths[0] is '' pane = atom.workspace.getActivePane() - if filePaths? and filePaths.length > 0 - newPane = pane.splitLeft() - for file in filePaths - do -> - atom.workspace.openURIInPane file, newPane + 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 - 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)