Danila Ermolchev Danila Ermolchev - 1 year ago 96
Python Question

sublime plugin. show find-panel and paste text

I need to get string from clipboard, then make with it some manipulations, run default find-panel and paste the string into this.

class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
s = sublime.get_clipboard()
s = s[:s.index('\n')]
self.view.run_command('show_panel', *args* )

In args I tried various interpretations of writing this snippet:

"args": {"panel": "find", "reverse": false} },

Answer Source

The show_panel command is a WindowCommand, so it can't be executed using view.run_command.

Instead, you must use the window reference:

window.run_command('show_panel', { 'panel': 'find' })

i.e. to get the window from your view:


The arguments parameter needs to be a dictionary of arguments.

args = dict()
args['panel'] = 'find'


args = {"panel": "find", "reverse": False}

self.view.window().run_command('show_panel', args)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download