From fdd8b36e62b880a197731b3f125dd85ed4299fbb Mon Sep 17 00:00:00 2001 From: Xiaolong Wang Date: Fri, 18 Mar 2016 14:09:14 -0500 Subject: [PATCH 1/6] 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 be1ba80..1e81c66 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) From b763104cb23ce070bd09cf8c815242e87abbff4d Mon Sep 17 00:00:00 2001 From: Xiaolong Wang Date: Fri, 18 Mar 2016 14:09:14 -0500 Subject: [PATCH 2/6] 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) From 286db320a80fa888d88f6f9591239815d096ea5f Mon Sep 17 00:00:00 2001 From: Xiaolong Wang Date: Sun, 24 Apr 2016 15:39:57 -0500 Subject: [PATCH 3/6] add test --- spec/ex-commands-spec.coffee | 47 ++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/spec/ex-commands-spec.coffee b/spec/ex-commands-spec.coffee index 2fa05c5..cb5fc33 100644 --- a/spec/ex-commands-spec.coffee +++ b/spec/ex-commands-spec.coffee @@ -497,26 +497,43 @@ describe "the commands", -> expect(atom.workspace.open).toHaveBeenCalled() describe ":split", -> - it "splits the current file upwards", -> + it "splits the current file upwards/downward", -> pane = atom.workspace.getActivePane() - spyOn(pane, 'splitUp').andCallThrough() - filePath = projectPath('split') - editor.saveAs(filePath) - keydown(':') - submitNormalModeInputText('split') - expect(pane.splitUp).toHaveBeenCalled() + if atom.config.get('ex-mode.splitbelow') + spyOn(pane, 'splitDown').andCallThrough() + filePath = projectPath('split') + editor.saveAs(filePath) + keydown(':') + submitNormalModeInputText('split') + expect(pane.splitDown).toHaveBeenCalled() + else + spyOn(pane, 'splitUp').andCallThrough() + filePath = projectPath('split') + editor.saveAs(filePath) + keydown(':') + submitNormalModeInputText('split') + expect(pane.splitUp).toHaveBeenCalled() # FIXME: Should test whether the new pane contains a TextEditor # pointing to the same path describe ":vsplit", -> - it "splits the current file to the left", -> - pane = atom.workspace.getActivePane() - spyOn(pane, 'splitLeft').andCallThrough() - filePath = projectPath('vsplit') - editor.saveAs(filePath) - keydown(':') - submitNormalModeInputText('vsplit') - expect(pane.splitLeft).toHaveBeenCalled() + it "splits the current file to the left/right", -> + if atom.config.get('ex-mode.splitright') + pane = atom.workspace.getActivePane() + spyOn(pane, 'splitRight').andCallThrough() + filePath = projectPath('vsplit') + editor.saveAs(filePath) + keydown(':') + submitNormalModeInputText('vsplit') + expect(pane.splitLeft).toHaveBeenCalled() + else + pane = atom.workspace.getActivePane() + spyOn(pane, 'splitLeft').andCallThrough() + filePath = projectPath('vsplit') + editor.saveAs(filePath) + keydown(':') + submitNormalModeInputText('vsplit') + expect(pane.splitLeft).toHaveBeenCalled() # FIXME: Should test whether the new pane contains a TextEditor # pointing to the same path From e6ab4167c9ba925ed1de90a65194d81a402eed5e Mon Sep 17 00:00:00 2001 From: Brian Vanderbusch Date: Wed, 18 May 2016 10:29:22 -0500 Subject: [PATCH 4/6] Contributing guidelines (#140) * Create Pull Request Template * added contributing guidelines - includes a pull request template * cleanup duped PR docs * finish fix of duped PR template * updated contributing guidelines per #140 * comma cleanup, needs tests info update --- .github/CONTRIBUTING.md | 29 +++++++++++++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 14 ++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..31132f0 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,29 @@ +# Ex-Mode Contributing Guidelines + +Current Maintainers: + +- [@jazzpi](https://github.com/jazzpi) +- [@LongLiveCHIEF](https://github.com/LongLiveCHIEF) + +This project is accepting new maintainers. Interested parties should + +1. Open a new issue, titled: `New Maintainer Request` +2. Assign the issue to [@lloeki](https://github.com/lloeki) +3. The last line of your request should `/cc @jazzpi @LongLiveCHIEF` + +## Pull Requests + +- If the PR *fixes* or should result in the closure of any issues, use the `fixes #` or `closes #` syntax to ensure issue will +close when your PR is merged +- All pull-requests that fix a bug or add a new feature *must* have accompanying tests before they will be merged. If you want +to speed up the merge of your PR, please contribute these tests + - *note*: if you submit a PR but are unsure how to write tests, please begin your PR title with `[needs tests]` +- Please use the [pull request template](PULL_REQUEST_TEMPLATE.md) as a guide for submitting your PR. +- Include a `/cc` for @LongLiveCHIEF and @jazzpi the current maintainers + +## Issues + +- Be aware of the responsibilities of `ex-mode` vs `vim-mode` +- If you have identified a bug we would welcome any Pull Requests that either: + - Fix the issue + - Create failing tests to confirm the bug diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ae22d79 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,14 @@ +Fixes # . + +Changes Proposed in this Pull Request: +- +- +- + +I have written tests for: + +- [ ] New features introduced +- [ ] Bugs fixed +- [ ] Neither (I'm just enhancing tests!) + +@jazzpi @LongLiveCHIEF From cd4fb6f359081971dfdc1e672f7638986ac809ca Mon Sep 17 00:00:00 2001 From: Brendon Roberto Date: Thu, 16 Jun 2016 14:58:06 -0400 Subject: [PATCH 5/6] Add tests for tabnew command with arguments --- spec/ex-commands-spec.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/ex-commands-spec.coffee b/spec/ex-commands-spec.coffee index cb5fc33..08237e3 100644 --- a/spec/ex-commands-spec.coffee +++ b/spec/ex-commands-spec.coffee @@ -496,6 +496,14 @@ describe "the commands", -> submitNormalModeInputText('tabnew') expect(atom.workspace.open).toHaveBeenCalled() + it "opens a new tab for editing when provided an argument", -> + spyOn(Ex, 'tabnew').andCallThrough() + spyOn(Ex, 'tabedit') + keydown(':') + submitNormalModeInputText('tabnew tabnew-test') + expect(Ex.tabedit) + .toHaveBeenCalledWith(Ex.tabnew.calls[0].args...) + describe ":split", -> it "splits the current file upwards/downward", -> pane = atom.workspace.getActivePane() From 4424eec4cc2a2c0542b3fbd000338983cfa4c662 Mon Sep 17 00:00:00 2001 From: Brendon Roberto Date: Thu, 16 Jun 2016 15:05:58 -0400 Subject: [PATCH 6/6] Fix issue with tabnew forwarding args to tabedit --- lib/ex.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ex.coffee b/lib/ex.coffee index c0ae5fd..c91beb7 100644 --- a/lib/ex.coffee +++ b/lib/ex.coffee @@ -127,11 +127,11 @@ class Ex tabe: (args) => @tabedit(args) - tabnew: ({ range, args }) => - if args.trim() is '' + tabnew: (args) => + if args.args.trim() is '' atom.workspace.open() else - @tabedit(range, args) + @tabedit(args) tabclose: (args) => @quit(args)