By josh / May 22, 2014

Copy copy copy with this new Sublime feature

I’ll admit it: I’m a copy-paste programmer.

That doesn’t mean I spend my time posting “can i haz all teh codez” comments on Stack Overflow.

And I don’t just swipe huge swaths of sample code from dodgy-looking blog posts and slap them into a production app. (OK, there was that one time…)

But particularly when I’m starting a new file, I’m not above trolling through similar files and grabbing chunks of code to get me started.

When I’m assembling one of these Frankenfiles, the back-and-forth gets old. Open a file. Copy. Switch to my new file. Paste. Open another file …

It would be great if Sublime let me just go on a shopping spree and copy copy copy to grab all the pieces I need, then assemble them later.

Turns out, it does.

The Paste from History command, new in Sublime Text 3, is perfect for this.

Running Paste from History (check under Edit | Paste from History to see the keyboard shortcut) pops up a context menu with a list of the last several items I’ve copied.

This makes it easy to put the code snippets together in the right order in my new file.

What, you’re still running Sublime Text 2? No worries. Just install the Clipboard History plugin and you’ll get a similar feature.

One side note on both of these: They only work on text you’ve copied from within Sublime.

By the way, I cover other new Sublime Text 3 features in the free Sublime Text Tips newsletter. You can get it here:

http://sublimetexttips.com/newsletter

About the author

josh

2comments
Yoni - September 19, 2014

I find myself doing it a lot. But if you copy past for quick boilerplate, its best to create a snippet.

Reply
Nicholas - August 3, 2015

Almost exactly what I want. I’m looking more like Intellij copy history is always there and not cleared after a paste is complete.

Reply
Click here to add a comment

Leave a comment: