ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Gherkin (Cucumber) Formatter

by waynemoore ST2/ST3

Gherkin Formatter for Sublime Text 2 and 3

Details

  • 2014.12.24.13.04.54
  • github.​com
  • github.​com
  • 5 years ago
  • 1 hour ago
  • 7 years ago

Installs

  • Total 25K
  • Win 8K
  • OS X 12K
  • Linux 5K
Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30
Windows 4 5 5 2 0 0 3 0 7 3 1 0 0 1 5 5 1 6 0 0 2 4 2 4 4 0 0 2 4 3 0 1 0 0 1 3 2 5 8 0 2 4 5 5 3 3
OS X 3 3 2 4 0 1 3 4 1 0 4 1 0 0 2 3 4 4 1 4 1 10 5 4 7 0 1 5 4 4 3 0 1 0 4 4 4 2 5 1 0 4 3 5 5 5
Linux 1 2 1 1 1 0 0 1 0 4 1 0 1 1 0 3 0 2 0 1 2 1 4 0 2 0 0 0 2 2 1 0 0 0 1 2 2 0 0 0 0 1 1 0 6 1

Readme

Source
raw.​githubusercontent.​com

Sublime Gherkin Formatter

Features

At this stage all it really does is format example group tables. The entire buffer will be formatted unless you select a specific region.

Spacing

Tables that look like this:

|cat breeds|country|
|Manx|Isle of Man|
|Octocat|The Web|

Will be reformatted to:

| cat breeds | country     |
| Manx       | Isle of Man |
| Octocat    | The Web     |

Indentation

Usually, people like to indent their tables from the rest of the text. This plugin respects the first line of the group's indent. So the following:

Then the "<cat breed>" is from "<country>"
    | cat breeds | country     |
| Manx       | Isle of Man |
            | Octocat    | The Web     |

Will be indented to:

Then the "<cat breed>" is from "<country>"
    | cat breeds | country     |
    | Manx       | Isle of Man |
    | Octocat    | The Web     |

Installing

Package control

You can now install this plugin using Sublime Package Control.

  1. Open Command Palette (<Cmd> + <Shift> + P on a Mac, or access via Tools menu)
  2. Find and select “Package Control: Install Package”
  3. Find and install “Gherkin (Cucumber) Formatter”

Manual

You can install this plugin manually by cloning it to your Sublime plugins directory:

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
$ git clone git://github.com/waynemoore/sublime-gherkin-formatter.git

Usage

There are a few ways to use it:

  • <Cmd> + <Shift> + | - This matches the TextMate cucumber plugin's key binding.
  • <Ctrl> + <Alt> + G - DEPRECATED. Original key binding still set to avoid surprise when upgrading the plugin.
  • Select “Gherkin/Cucumber: Format” from the Command Palette.

Contributing

It's a Python project, so I recommend you make use of virtualenv to manage dependencies.

  1. Clone repository
  2. $ pip install -r requirements.pip
  3. $ nosetests
  4. Write a test
  5. Implement your feature / bugfix
  6. Open a pull request

Contributors