20. Clipboard Utilities Available to Plugins
The following are the different clipboard-related functions in sublime.py (as of
build 4200):
def get_clipboard_async(callback: Callable[[str], None], size_limit: int = 16777216):
"""
Get the contents of the clipboard in a callback.
For performance reasons if the size of the clipboard content is bigger than
``size_limit``, an empty string will be passed to the callback.
.. since:: 4075
"""
sublime_api.get_clipboard_async(callback, size_limit)
def get_clipboard(size_limit: int = 16777216) -> str:
"""
Get the contents of the clipboard.
For performance reasons if the size of the clipboard content is bigger than
``size_limit``, an empty string will be returned.
:deprecated: Use `get_clipboard_async` instead. :since:`4075`
"""
return sublime_api.get_clipboard(size_limit)
def set_clipboard(text: str):
""" Set the contents of the clipboard. """
sublime_api.set_clipboard(text)