Move/copy pieces of text quickly to other files


#1

I usually manage a large file with multiple notes. When I open that file, I need to spend a considerable amount of time in distributing the text (the notes) among several files (through cut and paste).

It would be very useful to have some functionality to easily move a piece of selected text to a tab (open file) or other text file (e.g., append it at the end or at the beginning of the file). In this way, the time needed to cut, select the target tab, paste, and go back to the original file would be saved.

If anybody knows about any plugin or piece of code that I could inject to provide a functionality similar to this one, it would be great.

Thank you.


#2

Hi.

Would you consider moving those texts to snippets so that it is available to you as autocomplete?

As reference:
http://flight-manual.atom.io/using-atom/sections/snippets/

Regards.
- Dan


#3

Thank you very much for the suggestion.

However, sippets do not seem to be the best option, as the notes are not predefined. Basically, I have an input file with many notes and then I need to distribute them over several files. But the notes are free text and they can change every time. I understand that snippets are a good option to abbreviate text repeated frequently.


#4

The edit-in-new-tab package lets you copy/move selected text to a new file. Depending on your exact use case, you might want to disable the Synchronize Changes option in the package settings.


#5

Interesting, thank you very much.

However, I want to copy/move in an existing tab/file. So, I would need something like “edit-in-existing-tab”. It seems that that package does not exist. Maybe something similar?


#6

It’s not impossible, but it’s a very specific use case that isn’t well-supported to my knowledge. On a scale of 1 to Webpack, how fluent are you in JavaScript or CoffeeScript?


#7

I am not fluent specifically in JavaScript or CoffeeScript, although I programmed very basic commands in the init.coffee script. I am fluent in other languages like Java.

Thank you.


#8

I don’t have time to write a solution at the moment, but here’s the theory: each file is open as a TextEditor object, with methods for getting and setting text, cursors, selections, and decorations. If you have a method to tell Atom which object is associated with the destination file (let’s say a keybinding that marks the current editor as being the destination), it’s easy to have Atom append text to that specific file. If you want the ability to work with multiple destination files at once, the solution would have to include a means of queuing or removing destinations, and multiple keybindings for when you actually send the text over.