Reputation: 1255
Sublime Text 3's paste_from_history command is great, but I would like a longer history than 15 entries. Can this be configured?
Upvotes: 2
Views: 157
Reputation: 22791
This can't be configured directly, but you can modify the command itself to change the size of the history to achieve the same effect, if you would like.
To do so you need to create an override on the Default/paste_from_history.py
plugin file, which tells Sublime to use your modified version of the file instead of the one that it ships with.
The easiest way to do so would be to use the PackageResourceViewer package. From the command palette, choose PackageResourceViewer: Open Resource
(make sure you don't accidentally use the command with Extract
in the name) and select first Default
and then paste_from_history.py
.
This will open the packed version of the file and set things up so that you can edit it and easily make an override. The part you want to change is on line 12, where LIST_LIMIT
is defined to be 15:
class ClipboardHistory():
"""
Stores the current paste history
"""
LIST_LIMIT = 15
def __init__(self):
self.storage = []
You can change that number to the size that your desired value and save the file. As soon as you save, Sublime will reload the plugin and make your changes live (note that this clears the clipboard history).
Behind the scenes, what this is doing is creating a folder named Default
in your Packages
folder (Preferences > Browse Packages
shows you where that is), with the modified file stored inside.
As long as that file exists, while Sublime is loading packages it will ignore the version it ships with and use your modified copy instead. Removing your copy and restarting Sublime will revert back to the defaults.
Sublime won't warn you if a future update changes the shipped file; it will still always use your modified copy. If you want to be warned when this happens, the OverrideAudit package can come in handy. It will automatically detect when a file you're overriding is updated and warn you so that you can see if you need to incorporate any changes.
Upvotes: 7