Sublime Forum

Opening 'find in files' panel with a macro

#1

Iā€™m trying to record a macro that copies text and executes find_in_files with the copied text.

It looks like since Sublime Text 4, ST has supported recording find commands in macros.

Macros now record Find commands
Source

But when I try to run :point_down: in a macro I get an error:

	{
		"args": {"panel": "find_in_files"},
		"command": "show_panel"
	},

Unknown macro command show_panel.

Similarly if I execute :point_down:

	{
		"args": null,
		"command": "find_in_files"
	},

Unknown macro command find_in_files

Any idea what Iā€™m doing wrong or how to make this work?

0 Likes

#2

I was able to solve with a custom plugin.

import sublime
import sublime_plugin

class FindAllUnderCursorCommand(sublime_plugin.WindowCommand):
  def run(self):
    self.window.run_command("copy")
    self.window.run_command("show_panel", {"panel": "find_in_files"})
    self.window.run_command("paste")
0 Likes