duydao / Text-Pastry

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.
MIT License
832 stars 46 forks source link

How to increment across multiple files #44

Closed s10wen closed 8 years ago

s10wen commented 8 years ago

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) :+1:

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

duydao commented 8 years ago

Hey,

First, thanks for using Text Pastry!

This sounds interesting. Give me some time to check if multi-window-pastes are easy to implement. I' have another feature prepared to handle scenarios like this, so stay tuned.

Again, thanks for using Text Pastry!

s10wen commented 8 years ago

@duydao any luck with this please? Anything I can do to help test?

duydao commented 8 years ago

Thanks for getting back to me.

I've had a run with a version that replaced over multiple documents over this weekend, but it doesn't seem to be practical.

The order of the window seems to matter and there were multiple inserts in documents that we won't want. We would have to make sure that the only "pasteable" documents are open and that seems a bit unconvenient.

Do you have a specific use-case for this feature?

s10wen commented 8 years ago

@duydao I'm working on a large legacy code base that has multiple templates. Sometimes it can be time consuming to find the correct template to work on. If I can inspect an element, then do a find and replace adding an incremental value, I could then refresh the page and find which template it was related to.

I can always look at alternative ways of doing this via the command line, but it would have been nice if it was possible to it via Sublime Text.

Thanks for having a look anyway :+1:

duydao commented 8 years ago

As I mentioned, I have another feature that should do exactly what you're looking for. I'm calling it "paste gun", and if you don't mind to play a beta tester, I can upload the current version to this repo

s10wen commented 8 years ago

@duydao cool, yeah, please let me know how to test and I'll give it a go :)

duydao commented 8 years ago

are you working on linux, win or mac?

s10wen commented 8 years ago

Mac

duydao commented 8 years ago

I've just pushed the feature to the develop branch.

You will get a new menu item called Paste Gun

s10wen commented 8 years ago

Cloned the branch, where can I see the menu item Paste Gun? (not showing up from Cmd Shift p)

duydao commented 8 years ago

it should be in Sublime Text, between project and window. Are you using Sublime Text 2 or 3?

s10wen commented 8 years ago

3

screen shot 2016-03-22 at 19 54 41
duydao commented 8 years ago

Please verify the following steps:

Maybee you could check the Sublime Text console output

s10wen commented 8 years ago

yep, git clone -b develop git@github.com:s10wen/Text-Pastry.git didn't work though, so I did a git clone https://github.com/duydao/Text-Pastry.git then followed this http://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches to get your branch and switch to it.

duydao commented 8 years ago

ok, thanks for verifying!

Did you make the switch to the develop branch by calling "git checkout develop"? You can verify that you are on the right branch by checking for a file called text_pastry_clipboard.py

s10wen commented 8 years ago

Appears that I'm on the right branch, but I don't have that file.

s10wen commented 8 years ago

Something :fish: going on:

warning: refname 'origin/develop' is ambiguous.
warning: refname 'origin/develop' is ambiguous.
duydao commented 8 years ago

Hmm, could you remove the whole folder and check it out again with:

git clone -b develop git@github.com:duydao/Text-Pastry.git

s10wen commented 8 years ago

Ok, got the correct branch now and can see Paste Gun and Show Ammo. Did Cmd+Alt+T to get the command line open and put 1 x50 in there. But I'm not sure what you mean by start pasting?

duydao commented 8 years ago

Great! Ok, this is how it works:

s10wen commented 8 years ago

Bit confused sorry, I'd like to search and replace on existing files, not create new ones.

duydao commented 8 years ago

Hey @s10wen

Sorry, multiple selection weren't supported in that version. It is now :-)

1.5.0 will be released this week, just some documentation and more testing to do.

Thanks for using Text Pastry!

mrwiseowl commented 6 years ago

Hey @duydao did Paste gun ever go public? I'd love to give it a shot, I tried cloning from the developer branch above but got a permission denied.