Trigger built-in menu commands? Change focus from Find to the editor?

I’m a JS dev and I want to make an Editor Extension that simply executes a sequence of things already found in Nova’s UI:

  1. Editor > Selection > Select All Instances (Cmd-Ctrl-E, assuming that you have just done a Find)

  2. Focus on editor instead of Find field (can be done by Esc key, not sure how else; otherwise the following command won’t work on your document—it only happens uselessly INSIDE the Find field itself)

  3. Editor > Selection > Select Line (Cmd-L)

Done by hand, that sequence selects all the lines containing the current Find, ready to Copy or Cut. But I’d love to automate it under a single keyboard shortcut (a la BBEdit). Hopefully without re-inventing the wheels already found in Nova’s menus.

TIA!

1 Like

Hi there,

As Im reading through your case I think you should be able to do that by using cmd+D after selecting first occasion of repeating pattern.

You can hold cmd+D until all of them are selected and them manipulate them as you wish.

Hope it helps.

1 Like

The Select Next Instance (Cmd-D) keybinding won’t save you any keystrokes vs. Select All Instances – especially if you need to find an instance first – and won’t combine commands as Morgan desires. Additionally, you unfortunately won’t be able to offer this workflow in an extension without “re-inventing the wheels already found in Nova” because these commands are not callable through the Extensions API.

I’ve been able to use custom keybindings in other editors with Vim emulation to combine Vim commands or even call editor commands, but sadly that’s not a feature of Nova’s Vim emulation. (That’s not to say Nova’s Vim mode isn’t excellent – they definitely delivered on the bread-and-butter Vim features).

As far as I know, your only option right now for automating these steps is to use something like Keyboard Maestro. That, or “reinvent the wheel” in a custom extension.

2 Likes

Thanks for the ideas!