Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit b2576dc
Author: Duy Dao <duy@daonet.ch>
Date:   Sun Dec 14 21:57:44 2014 +0100

    Added x-arg support, date range and autostep

commit d534e78
Author: Duy Dao <duy@daonet.ch>
Date:   Sun Nov 23 20:00:48 2014 +0100

    update readme, change date range to 1.4.3

commit faa5756
Merge: 8b0c069 348b6eb
Author: Duy Dao <duy@daonet.ch>
Date:   Sun Nov 23 19:56:11 2014 +0100

    Merge branch 'master' into develop

commit 8b0c069
Author: Duy Dao <duy@daonet.ch>
Date:   Tue Nov 18 21:50:44 2014 +0100

    update readme, add 1.4.1

commit 18ad3f6
Author: Duy Dao <duy@daonet.ch>
Date:   Tue Nov 18 21:33:45 2014 +0100

    Hotfix for #23

    remove insert nums-dependency in menu/history, keep compatibility for old history entries.

commit eaedfe7
Author: Duy Dao <duy@daonet.ch>
Date:   Sat Nov 15 18:52:26 2014 +0100

    added end-of-the-month command, removed print, renamed "repeat" to "step_size"

    alias:

    eom | end-of-month | eotm | end-of-the-month
    ldom | last-day-of-month | ldotm | last-day-of-the-month

commit 8fa00de
Author: Duy Dao <duy@daonet.ch>
Date:   Sat Nov 15 02:45:05 2014 +0100

    fix

commit f1d10d9
Author: Duy Dao <duy@daonet.ch>
Date:   Sat Nov 15 02:44:06 2014 +0100

    update readme

commit 1a9754e
Author: Duy Dao <duy@daonet.ch>
Date:   Sat Nov 15 02:40:20 2014 +0100

    Added date range feature

    - new commands day/week/month/year X
    - X stands for the number of dates. Used if there is no multiselect or if X < number of selections
    - new setting "date_format"
    - new setting list "parse_date_format"
    - selected a single date to use it as start date and X for the amount of dates that should be generated
  • Loading branch information
duydao committed Dec 14, 2014
1 parent 348b6eb commit 4096504
Show file tree
Hide file tree
Showing 3 changed files with 481 additions and 14 deletions.
278 changes: 274 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

_Text Pastry_ is a free plugin for [Sublime Text](http://www.sublimetext.com/), designed to reduce repetetive work by extending the [multiple selections](https://www.sublimetext.com/docs/selection) feature of [Sublime Text](http://www.sublimetext.com/).


## Features include: ##

- Incremental numbers/sequences _(1, 2, 3 or 100, 80, 60)_
Expand All @@ -11,12 +12,281 @@ _Text Pastry_ is a free plugin for [Sublime Text](http://www.sublimetext.com/),
- Extendable list of commands
- Create and modify selections
- Improved paste _(paste the first three lines of the clipboard data to the three selected locations)_
- Generate date ranges

## What's new ##
- 1.4.3: New commands! Generate date ranges command, repeat argument (x-arg), and the [Auto Step](https://github.com/duydao/Text-Pastry/issues/20) command
- 1.4.2: Fix range / negative steps [#24](https://github.com/duydao/Text-Pastry/issues/24) - Thanks [@TheClams](https://github.com/TheClams)
- 1.4.1: Hotfix for [#23](https://github.com/duydao/Text-Pastry/issues/23) - Thanks [@dufferzafar](https://github.com/dufferzafar)
- 1.4.0: [New Features!](https://github.com/duydao/Text-Pastry#release-notes-140)

## Release Notes 1.4.3 ##

This release brings us 3 new features!

## New Features ##

### Generate date ranges ###

New settings:

```
"parse_date_formats": [
"%d.%m.%Y"
],
```

parse_date_formats is used to parse the date from the _Text Pastry_ command line. For supported date formats, please check out http://strftime.org/

```
"date_format": "%d.%m.%Y",
```

used to generate the date range. For supported date formats, please check out http://strftime.org/. For our convenience, we can set the date format-setting by calling the date-format command:

```
date-format %Y-%m-%d
```

**date range commands**

Command:

```
days x5
```

Result:

```
14.12.2014
15.12.2014
16.12.2014
17.12.2014
18.12.2014
```

Command:

```
weeks
```

Result:

```
14.12.2014
21.12.2014
28.12.2014
04.01.2015
11.01.2015
```

Command:

```
months
```

Result:

```
14.12.2014
14.01.2015
14.02.2015
14.03.2015
14.04.2015
```

Command:

```
end-of-month
```

Result:

```
31.12.2014
31.01.2015
28.02.2015
31.03.2015
30.04.2015
```

Command:

```
years
```

Result:

```
14.12.2014
14.12.2015
14.12.2016
14.12.2017
14.12.2018
```

We can add a start date to date range commands:

```
weeks 14.03.2015
```

Result:

```
14.03.2015
21.03.2015
28.03.2015
04.04.2015
11.04.2015
```

The date range command supports the newly introduced x-arg! Lets generate 30 dates:

```
days x30
```

```
14.12.2014
15.12.2014
16.12.2014
...
10.01.2015
11.01.2015
12.01.2015
```

### Repeat argument (x-arg) ###
Before this release, we had to create empty lines and do a multiselect to create a number sequence. With 1.4.3, we can use this command to create new lines on the fly:

Source:
```
|
```


```
1 x5
```

We will give us this result:

```
1|
2|
3|
4|
5|
```

_Text Pastry_ will duplicate the line and add the number sequence to it, so the line doesn't have to be empty:

```
<div id="row-|"></div>
```

Using ``1 x3`` will give us this:

```
<div id="row-1"></div>
<div id="row-2"></div>
<div id="row-3"></div>
```

The x-arg is supported by the [**UUID/uuid** command](https://github.com/duydao/Text-Pastry/wiki/Command-Line-Reference), the [N M P command](https://github.com/duydao/Text-Pastry/wiki/Examples#insert-nums-syntax), the [range command](https://github.com/duydao/Text-Pastry/wiki/Command-Line-Reference) and the date range command.

**Note:**: Please note that the x-argument will be ignored if we have multiple selections. If we have 5 selections, _Text Pastry_ will behave the same way as before and will fill all selections with a sequence number.


### Auto step (aka. Text with sequence [#20](https://github.com/duydao/Text-Pastry/issues/20)) ###

Inspired by @passalini's request, I've added the auto step feature. Use this command:

Command: ```as <text> [step] [x-arg]```

```
as row-1
```

For each selection we've made, _Text Pastry_ will insert the text and increment the number by ``[step]`` (default is ``1``). As example, if we had 4 selections, we will get this:

Source:

```
<div id="|"></div>
<div id="|"></div>
<div id="|"></div>
<div id="|"></div>
```

Result:

```
<div id="row-1"></div>
<div id="row-2"></div>
<div id="row-3"></div>
<div id="row-4"></div>
```

Auto step supports a step size argument:

```
as row-0 2
```

Result:

```
<div id="row-0"></div>
<div id="row-2"></div>
<div id="row-4"></div>
<div id="row-6"></div>
```

Auto Step supports the x-arg:

Source:

```
<div id="|"></div>
```

Command:

```
as row-10 10 x10
```

will expand to this:

```
<div id="row-10"></div>
<div id="row-20"></div>
<div id="row-30"></div>
<div id="row-40"></div>
<div id="row-50"></div>
<div id="row-60"></div>
<div id="row-70"></div>
<div id="row-80"></div>
<div id="row-90"></div>
<div id="row-100"></div>
```

### Generate a bunch of UUIDs ###

The UUID/uuid command supports the newly introduced x-arg. Use this command to generte 100 UUIDs:

```
UUID x100
```


## Release Notes 1.4.0 ##

I'm very excited to announce v1.4.0! The Code was actually released a few months ago, but I need the extra time to check the new features and update the [wiki](https://github.com/duydao/Text-Pastry/wiki).
Expand Down Expand Up @@ -280,19 +550,19 @@ _Text Pastry_ has a build in support for the [Insert Nums](https://github.com/jb
Check out the [wiki](https://github.com/duydao/Text-Pastry/wiki/Examples) for examples!

## Todo ##
- date ranges
- formatters
- wrappers [#20](https://github.com/duydao/Text-Pastry/issues/20)
- incremental search: add search terms to selection by shortcut (work-in-progress)
- smart case: determine case-sensitivity by search term

## Wishlist ##
- Webservice "Shell": use a custom (web-)service to process our selections
- yankring

## Done ##
- ~~Alphabetical sequence (upper/lower case)~~(1.4.0)
- ~~Random numbers, strings and sequences~~ (use [Random Everything](https://sublime.wbond.net/packages/Random%20Everything) in combination with commands~~
- ~~date ranges~~ (1.5.0)
- ~~incremental search: add search terms to selection by shortcut (work-in-progress)~~ (1.4.0, use ``add``)
- ~~Alphabetical sequence (upper/lower case)~~ (1.4.0)
- ~~Random numbers, strings and sequences~~ (use [Random Everything](https://sublime.wbond.net/packages/Random%20Everything) in combination with commands)
- ~~Command List Overlay~~
- ~~Command History~~
- ~~UUID generation~~
Expand Down
31 changes: 30 additions & 1 deletion config/TextPastryCommands.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@

// generate UUID
{"match": "^\\\\UUID$", "command": "text_pastry_uuid", "args": {"uppercase": true} },
{"match": "^\\\\UUID x(\\d+)$", "command": "text_pastry_uuid", "args": {"uppercase": true, "repeat": "$1"} },

{"match": "^UUID$", "command": "text_pastry_uuid", "args": {"uppercase": true} },
{"match": "^UUID x(\\d+)$", "command": "text_pastry_uuid", "args": {"uppercase": true, "repeat": "$1"} },

{"match": "^\\\\uuid$", "command": "text_pastry_uuid" },
{"match": "^\\\\uuid x(\\d+)$", "command": "text_pastry_uuid", "args": {"uppercase": true, "repeat": "$1"} },

{"match": "^uuid$", "command": "text_pastry_uuid" },
{"match": "^uuid x(\\d+)$", "command": "text_pastry_uuid", "args": {"uppercase": true, "repeat": "$1"} },

// paste clipboard with custom separator
{"match": "^\\\\p\\((.*?)\\)?$", "command": "text_pastry_insert_text", "args": {"separator": "$1", "clipboard": true} },
Expand Down Expand Up @@ -83,6 +90,28 @@

{"match": "^range (-?\\d+)[-, ](-?\\d+)[, ](-?\\d+)$", "command": "text_pastry_range", "args": {"start": "$1", "stop": "$2", "step": "$3"} },
{"match": "^range (-?\\d+)[-, ](-?\\d+)$", "command": "text_pastry_range", "args": {"start": "$1", "stop": "$2"} },
{"match": "^range (-?\\d+)$", "command": "text_pastry_range", "args": {"stop": "$1"} }
{"match": "^range (-?\\d+)$", "command": "text_pastry_range", "args": {"stop": "$1"} },

// add x-arg support to date ranges
{"match": "^(?:days|day) ?(.*) x(\\d+)$", "command": "text_pastry_date_range", "args": {"text": "$1", "repeat": "$2"} },
{"match": "^(?:weeks|week) ?(.*) x(\\d+)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "week", "repeat": "$2"} },
{"match": "^(?:months|month) ?(.*) x(\\d+)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "month", "repeat": "$2"} },
{"match": "^(?:end-of-month|eom|end-of-the-month|eotm|last-day-of-month|ldomlast-day-of-the-month|ldotm) ?(.*) x(\\d+)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "month", "last_day_of_month": true, "repeat": "$2"} },
{"match": "^(?:years|year) ?(.*) x(\\d+)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "year", "repeat": "$2"} },

{"match": "^(?:date-format) (.+)$", "command": "text_pastry_setting", "args": {"name": "date_format", "value": "$1"} },
{"match": "^(?:days|day) ?(.*)$", "command": "text_pastry_date_range", "args": {"text": "$1"} },
{"match": "^(?:weeks|week) ?(.*)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "week"} },
{"match": "^(?:months|month) ?(.*)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "month"} },
{"match": "^(?:end-of-month|eom|end-of-the-month|eotm|last-day-of-month|ldomlast-day-of-the-month|ldotm) ?(.*)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "month", "last_day_of_month": true} },
{"match": "^(?:years|year) ?(.*)$", "command": "text_pastry_date_range", "args": {"text": "$1", "step_size": "year"} },

{"match": "^x(\\d+) (.+?) (-?\\d*)$", "command": "text_pastry_auto_step", "args": {"text": "$2", "step_size": "$3", "repeat": "$1"} },
{"match": "^x(\\d+) (.+?)$", "command": "text_pastry_auto_step", "args": {"text": "$2", "repeat": "$1"} },
{"match": "^(?:s|as) (.+?) (-?\\d+) x(\\d+)$", "command": "text_pastry_auto_step", "args": {"text": "$1", "step_size": "$2", "repeat": "$3"} },
{"match": "^(?:s|as) (.+?) x(\\d+) (-?\\d*)$", "command": "text_pastry_auto_step", "args": {"text": "$1", "step_size": "$3", "repeat": "$2"} },
{"match": "^(?:s|as) (.+?) x(\\d+)$", "command": "text_pastry_auto_step", "args": {"text": "$1", "repeat": "$2"} },
{"match": "^(?:s|as) (.+?) (-?\\d+)$", "command": "text_pastry_auto_step", "args": {"text": "$1", "step_size": "$2"} },
{"match": "^(?:s|as) (.*)$", "command": "text_pastry_auto_step", "args": {"text": "$1"} }
]
}
Loading

0 comments on commit 4096504

Please sign in to comment.