Python sublime.get_clipboard() Examples

The following are 8 code examples of sublime.get_clipboard(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: sublime_terminal_buffer.py    From TerminalView with MIT License 6 votes vote down vote up
def run(self, edit, bracketed=False):
        # Lookup the sublime buffer instance for this view
        sub_buffer = SublimeBufferManager.load_from_id(self.view.id())
        keypress_cb = sub_buffer.keypress_callback()
        if not keypress_cb:
            return

        # Check if bracketed paste mode is enabled
        bracketed = bracketed or sub_buffer.terminal_emulator().bracketed_paste_mode_enabled()
        if bracketed:
            keypress_cb("bracketed_paste_mode_start")

        copied = sublime.get_clipboard()
        copied = copied.replace("\r\n", "\n")
        for char in copied:
            if char == "\n" or char == "\r":
                keypress_cb("enter")
            elif char == "\t":
                keypress_cb("tab")
            else:
                keypress_cb(char)

        if bracketed:
            keypress_cb("bracketed_paste_mode_end") 
Example #2
Source File: core.py    From Terminus with MIT License 6 votes vote down vote up
def run(self, edit, bracketed=False):
        view = self.view
        terminal = Terminal.from_id(view.id())
        if not terminal:
            return

        bracketed = bracketed or terminal.bracketed_paste_mode_enabled()
        if bracketed:
            terminal.send_key("bracketed_paste_mode_start")

        copied = sublime.get_clipboard()

        # self.view.run_command("terminus_render")
        self.view.run_command("terminus_show_cursor")

        terminal.send_string(copied)

        if bracketed:
            terminal.send_key("bracketed_paste_mode_end") 
Example #3
Source File: commands.py    From network_tech with Apache License 2.0 5 votes vote down vote up
def clear_clipboard(view, password):
    if sublime.get_clipboard() == password:
        sublime.set_clipboard('')
        view.window().status_message('Network Tech: Password cleared from clipboard') 
Example #4
Source File: import_helper.py    From sublime-import-helper with MIT License 5 votes vote down vote up
def run(self, edit):
        insert_import_command(
            view=self.view,
            name=sublime.get_clipboard(),
            notify=True,
            entry_modules=SOURCE_MODULES + NODE_MODULES,
            typescript_paths=TYPESCRIPT_PATHS,
        ) 
Example #5
Source File: find_results_copy.py    From SublimeScraps with MIT License 5 votes vote down vote up
def run(self):
        sublime.active_window ().run_command ("copy")
        sublime.set_clipboard (re.sub (r"^\s*[0-9]+.", "",
            sublime.get_clipboard (), flags=re.MULTILINE)) 
Example #6
Source File: clipboard.py    From Terminus with MIT License 5 votes vote down vote up
def on_post_text_command(self, view, name, args):
        if view.settings().get('is_widget'):
            return

        if name == 'copy' or name == 'cut':
            g_clipboard_history.push_text(sublime.get_clipboard()) 
Example #7
Source File: core.py    From Terminus with MIT License 5 votes vote down vote up
def on_post_text_command(self, view, name, args):
        """
        help panel terminal to capture copied text
        """
        if not view.settings().get('terminus_view'):
            return

        if name == 'terminus_copy':
            g_clipboard_history.push_text(sublime.get_clipboard()) 
Example #8
Source File: clipboard.py    From SendCode with MIT License 5 votes vote down vote up
def set_clipboard(self, cmd):
        if not self.thread:
            self.cb = sublime.get_clipboard()
        else:
            self.thread.cancel()
            self.thread = None

        sublime.set_clipboard(cmd)