Giter Site home page Giter Site logo

duydao / text-pastry Goto Github PK

View Code? Open in Web Editor NEW
825.0 15.0 46.0 343 KB

Extend the power of multiple selections in Sublime Text. Modify selections, insert numeric sequences, incremental numbers, generate uuids, date ranges, insert continuously from a word list and more.

License: MIT License

Python 100.00%
sublime-text python number-range increment-number editor sublime-text-plugin sublime copy-paste uuid-generator

text-pastry's People

Contributors

acroca avatar adzenith avatar bitcity avatar davidnormo avatar duydao avatar edwardgronroos avatar forcey avatar gregsadetsky avatar jbrooksuk avatar mpcabd avatar mrperleberg avatar paramire avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

text-pastry's Issues

Command line error

Command line commands does not work for me. Command palette works fine.

When i select some stuff with ctrl+d, and using a simple command like \i, i got this error, plus nothing happends.

Traceback (most recent call last):
File ".\text_pastry.py", line 238, in on_done
TypeError: parse() takes exactly 1 argument (2 given)

Possible Documentation Error

In the documentation, for the "Start at 1000, adding 100 for each selection" example the documentation states the proper command is "\i(1000,100)".

On my system — Sublime Text 2 (Build 2220) on OS X 10.8 — \i(1000,100) is not working. Instead, if I have four lines selected, I get the following.

1
2
3
4

A little trial-and-error revealed removing the parens gets the desired result. So, /i1000,100 returns:

1000
1100
1200
1400

Text Pastry conflicts with PopClip

Discovered a conflict between Text Pastry, the OS X utility app PopClip, and Sublime Text 3. When Text Pastry is installed, something keeps PopClip from appearing when text is selected with the mouse.

If you're not familiar with PopClip, it's allows you to do a number of great things with selected text. With Text Pastry disabled, using the mouse to highlight a string reveals a little toolbar. However, with Text Pastry enabled, the doesn't appear. A demo is available at the site above.

My setup is Sublime Text 3 (3062), PopClip 1.4.10, and Text Pastry 1.3.6 running on Mac OS X 10.9.4.

Feature From X to Y

Using the number in the first selection as the x and then numbering from there.

func(4);
func(4);
func(4);

becomes

func(4);
func(5);
func(6);

Sublime command palette inserts numbers one space before the cursor

There seems to be a bug when using Sublime's command palette to insert numbers. When the command is executed, the numbers are inserted one character behind the cursor. This does not seem to be the case if the Text-Pastry command line is used directly.

Given the following segment of code as an example, the goal is to insert a number before the semicolon: constant_1 = 101;

constant_1 = ;
constant_2 = ;
constant_3 = ;
constant_4 = ;

So the first step is to position multiple cursors (illustrated wtih |) just before the semicolon, just as you would if you were to start typing more text. Although this may appear obvious, I state it because it is an important issue regarding the bug.

constant_1 = |;
constant_2 = |;
constant_3 = |;
constant_4 = |;

Open Sublime's command palette via ctrl + shift + p, select Text Pastry: Command Line, and enter \i101. The inserted numbers end up behind the cursor location.

constant_1 =101 ;
constant_2 =102 ;
constant_3 =103 ;
constant_4 =104 ;

Running the same command by opening the Text-Pastry command line directly with the respective hotkey (not through Sublime's command palette) works as expected.

constant_1 = 101;
constant_2 = 102;
constant_3 = 103;
constant_4 = 104;

Some presets don't work

Hi,
I'm using Text-Pastry 1.4.10 with ST2, I'm trying to use presets,

I writeletters a-c, the result is

letters a-c

, like it does not recognize the preset

same for greek Alpha-Beta

When I write months, I get

08/12/16

I tried simple selection and multi selection, the result is the same.

Inserting text removes selections

If I have four selections, type CMD+ALT+N and then "a b c d"+ENTER, the characters are properly inserted but I lose my selections — only the last remains.

If instead I have four selections, type CMD+ALT+N and then "\i"+ENTER, however, the numbers {1,2,3,4} are inserted and my four selections are preserved.

Running Sublime Text 2 on MacBook Pro with OS X 10.7.

sequence of random numbers

There have been a few times where I've wanted to create a sequence of random numbers, but I'm unsure how to do this with TextPastry. Is this possible?

increment selected numbers

Hi,

first of all great tool! I'm just missing one feature or I'm not sure if it's already there.
With this selection:
1|
2|
2|
3|
I'd lile to have this result:
2|
3|
3|
4|

Meaning: I wnat to add 1 (or any number) to each selected number. Is that at all possible or in any way planned as a new feature?

Best regards,
Jan

Pad with spaces instead zeroes

It would be great to have some sort a way to pad with spaces instead of zeroes! Simple example (padding 2):

 2
 4
 6
 8
10
12

Not sure what to suggest for a command, though!

Keyboard shortcuts conflicts with czech keyboard

I'm used to Czech keyboard which uses combinations with AltGr (right alt, equivalent to Ctrl+Alt) to write some special chars. For example AltGr + B (or Ctrl + Alt + B) means {.

TextPastry's default keymap conflicts with these, so I'm unable to write those special chars.

Can you please make these keyboard shortcuts optional?

How to increment across multiple files

What I'd like do is

FROM:

file1.txt:
word
word
word
file2.txt:
word
word
word

TO:

file1.txt:
word1
word2
word3
file2.txt:
word4
word5
word6

I got it working with one file thanks to @wesbos (also thanks for pointing me here) 👍

Would be great if there was a way to do across multiple files, thanks ^_^

zero padding ?

I am trying to do zero padding.

say

C|000002|1
C|000003|1
C|000004|1
C|000005|1
...
C|000100|1

as 0000001 x 300 or similar using a token similar to sprintf %06d etc.

Number sequence "each"

Hi there,

Firstly thanks for text pastry, use it many times every day!

Secondly, I would like to be able to generate a number sequence like:
1 1 2 2 3 3 4 4
Sorry if this is already possible and I haven't seen it. So in text pastry this might be \i(each = 2)

Thanks :)

Feature request! - From X to 1 (and From X to 0)

I absolutely love this package, and I use it all the time.

Is it possible to include a From X to 1 (the reverse order of From 1 to X) and From X to 0 feature? I think that I might use this from time to time too, and I suspect others may as well.

Thank you

Charlie

The insert_nums command doesn't seem to be working on ST3 Build 3065

\i0, \i1 commands stopped working for me while everything else was working as expected.

I couldn't figure out what exactly was causing the bug, but got things working for myself by changing the following lines (in text_pastry.py, Line 600):

self.history_manager.append(data={"command": "insert_nums", "args": {"current": "1", "step": "1", "padding": "1"}}, label=item.label)
self.window.run_command("insert_nums", {"current": "1", "step": "1", "padding": "1"})

with:

self.history_manager.append(data={"command": "text_pastry_range", "args": {'start': 1, 'step': 1, 'padding': 1}}, label=item.label)
self.window.run_command("text_pastry_range", {'start': 1, 'step': 1, 'padding': 1})

\i(N,M) not work on sublime 3 in windows 8

Hi, this plugin is really awesome.
Because the default shortcut ctrl + alt + n is conflict with Evernote's create new note shortcut, I'd like to use ctrl + alt +t. But I find it cannot excute pattern like 1 1 3 except already type it once in ctrl + alt + n as history command. Then I tried \i(1,2) which not works, though \i and \i0 does.

Repeating increments not working with letters

I wanted Text-Pastry to do this:

A
A
A
B
B
B
C
C
C

I've tried to use "letters 1-3 each=3", but it didn't work. :(

It'd be great if repeating increments would work for not just letters, but anything else, simply by adding the "each" keyword. Of course, if I'm missing something here and this is already possible, I'd love to be corrected (but then also wiki should have examples of this, too :))

Thanks!

TextPastryHistory is not defined / ST3 /

Hi,
I cant use shortcut alt +b (insert character "{") because TextPastry is screaming:

"TextPastryHistory is not defined"

I obviously override shortcut in sublime-keymap but TextPastry remember native shortcut defined in plugin.

Can you help me?

Screenshots:

Math with your selection?

Hello!

Is it possible to do math and use functions like sin/cos/ceil/floor and etc and apply it to my selection?

Thank you!

Stopped inputting text at v1.3.5

All of a sudden the plugin stopped inserting the text...

No error logged in console...

Background to the input area lost it's dark background...

image

Reverted to 1.3.4 and it's working again...

Running ST2 on Windows 8...

Number sequence does not work

Inserting number sequence does not work giving the following error when checked in the sublime console:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 543, in run_
    return self.run(edit, **args)
TypeError: run() got an unexpected keyword argument 'padding'

I am using Sublime Text 3, Build 3059, with Text pastry installed using Package Control.

Other commands like Paste work fine.

Idea: loop a range within text selection

This is similar to using "each" keyword, but a bit differently.

In this idea, let's say we want to generate the same range of values but repeated multiple times. We need to define start value, END VALUE (new!), optionally step size, optionally number of digits, and then repeat it throughout the text selection. Let's call this new keyword "loop"

For example this command:

0 10 2 2 each=2 loop

executed in a selection of 20 rows would result in this:

00
00
02
02
04
04
06
06
08
08
10
10
00
00
02
02
04
04
06
06

Do you think this might be useful? :)

History

Just a suggestion, it would be nice to have history by pressing up in the dialog box.

Missing On Package Manager

I am unable to install the package from the package manager. I am seeing this on the package manager website.

screen shot 2017-07-17 at 2 38 07 pm

Found patterns not scroll into view

When I use find command to find some stuff, the found result only shown in status bar. If I ignore the status bar or I hide the status bar, and the found pattern not shown in viewport, it just feels nothing happened. So we can improve the experience one step further -- scroll the first matched pattern into view.

Insert Text Function Not Working

Using Sublime Text 2 (Build 2220) on OS X 1.8 the insert text function does not work when using either direct input or the clipboard shortcut.

If I create five lines, each containing the word "null" and using either Command-D or Command-Click to highlight each instance (for a multiple selection) and entering any space-separated string (such as your "INPUT SELECT TEXTAREA DIV P A" example) leaves the nulls in place.

The status bar does state "Inserting INPUT SELECT TEXTAREA DIV P A".

The version I am trying this with includes the Fix No. 1 from a few hours ago.

Same UUID on multiple selections?

Currently when I us Sublimes Multiline Selection and run the uuid/UUID command with Text Pastry, it generates different UUIDs for each selection. I understand the reasoning behind this, but is there any way I can make it generate the same UUID on each selection?

Feature to add text with sequence

I can do it using multi select and the plugin, but it will be nice with we have a command to do it! Ex:

student_\i(1, 10)

=> student_1
student_10
student_20
.
.
.

In multiple selections is it possible to order incremented numbers or pasted text by row first, and then by column?

e.g. in multi-selections like this (| represents the text caret):

<td>|</td><td>|</td>
<td>|</td><td>|</td>
<td>|</td><td>|</td>

instead of having:

<td>1|</td><td>2|</td>
<td>3|</td><td>4|</td>
<td>5|</td><td>6|</td>

to be able to have:

<td>1|</td><td>4|</td>
<td>2|</td><td>5|</td>
<td>3|</td><td>6|</td>

or in case of copy-paste (with Ctrl+Alt+V), to be able to paste this:

foo
bar
baz
qux
quux
corge

like this:

<td>foo|</td><td>qux|</td>
<td>bar|</td><td>quux|</td>
<td>baz|</td><td>corge|</td>

instead of:

<td>foo|</td><td>bar|</td>
<td>baz|</td><td>qux|</td>
<td>quux|</td><td>corge|</td>

lost window focus?

When i'm using the "text list" feature, exp.:

var := " "
var := " "
var := " "
var := " "

and want to paste something between the double quotes like 'a b c d'. After i execute the command (which works fine now) i lost the window's focus. It's not on the sidebar, nor on the main window. I need to click on the editor to be able to type again.

New Tag.

can u plz make a new tag to reflect the latest version on PC ?

InsertNum negative step not working anymore

Trying to insert a numeric sequence using both available syntax ( 'i(8,-1)' or '8 -1 0') failed with the error "No text found for Insert Text".
This was working at least last week.

Group restart sequence

I m not sure how - or if - it is possible (an enhancement perhaps).
Here is a sample of an XML file.

<person>
  <name>Jane</name>
  <item>wallet</item>
  <item>car</item>
  <item>tv</item>
  <item>cellphone</item>
</person>
<person>
  <name>Chris</name>
  <item>pc</item>
  <item>cat</item>
</person>

I d like enumeration to restart somehow on each persons group of items like this

<person>
  <name>Jane</name>
  <item1>wallet</item1>
  <item2>car</item2>
  <item3>tv</item3>
  <item4>cellphone</item4>
</person>
<person>
  <name>Chris</name>
  <item1>pc</item1>
  <item2>cat</item2>
</person>

Repeat incremented steps

Hello!

It would be extremely great if Text-Pastry could be able to repeat increments as in this example:

N M P R
1 2 0 1

or:

i(1,2,1)

results in:

1
1
3
3
5
5
7
7
etc.

Basically, R would be number of additional repeats of a particular increment.

Thank you!

1.5 release?

Hi,

Just wondering, why was 1.5 "released" in May but never really released?

Multi-word phrases for Text Command

Trying to use Text Pastry with some kind of separator between text phrases, rather than just a whitespace character. For example, if I were to write:

Pepsi Coca Cola Dr. Pepper --> 5 selections

versus:

Pepsi, Coca Cola, Dr. Pepper --> 3 selections

If there's already a way to do this, then great! Just haven't found it by searching through the docs.

Define sublime commands

It would be great to have got sublime commands so the command pallete can be used to trigger the actions.

Regards
Armando

Syntax to include space in clipboard text

Sorry this is long-winded. I think Text Pastry should be able to handle my use case, but I'm having trouble. I'd like to take:

hey there
how are you?
what's happening?

And get:

greeting1: hey there
greeting2: how are you?
greeting3: what's happening?

However, I get this instead:

greeting1:hey there
greeting2:how are you
greeting3:what's happening

I'm having trouble achieving the space character between the colon and the value. Notice also the leading space on lines 2 and 3.

I'm doing the following to get the actual output:

  1. Cut this text into the clipboard:

greeting1:
greeting2:
greeting3:

  1. Using CMD + click to insert a cursor in front of each line.

  2. Using CMD + ALT + N to enter \p(\n)

I've tried variations with spaces after each colon to no avail.

I believe there are some settings that can change this behavior, but I don't want it all the time, so I'd prefer a way to specify an alternate text separator character.

For example, if I were able to type something like this into CMD + ALT + N:

\s(|) greeting1: |greeting2: |greeting3:

Then Text Pastry would treat space like any other character and use the pipe symbol to delimit the list.

Another option would be to allow backslash escaping of space characters, like so:

greeting1:\ greeting2:\ greeting3:

What do you think? Is this worth pursuing?

Iterating letters

Would be great to have a way to generate letter sequences (A, B, C, D..., a, b, c, d,... perhaps even roman numerals? That might be overkill). When the end of the alphabet is reached, stick another char there (W, X, Y, Z, AA, AB, AC, etc.)

:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.