Sublime Forum

Mark all found lines and toggle

#1

One of the useful features of my current text editor is that the Find dialog box has an option to “mark” all lines on which the search string is found. I can then do operations on these “marked” lines, like delete them all, or copy them to clipboard.
Sometimes it’s easier for me to mark a bunch of lines, then invert the marks

If anyone has used ISPF editor they will know I’m talking about command sequences like x all; f all ‘string’; del all nx

how may I do this in SublimeText?

Thanks!

0 Likes

#2

The ST find dialog allows you to Find All (Alt+F3 on Win/Linux; not sure about OS).

This will put a cursor on each match, allowing you to edit them as you like. ESC will take you to the original cursor.

I don’t understand what you mean by “invert the marks”. It’s possible to find all as above and then invert the selection via the Selection menu (you can create a command or binding if it’s something you use often). Or have I misunderstood?

Alex

0 Likes

#3

[quote=“quodlibet”]The ST find dialog allows you to Find All (Alt+F3 on Win/Linux; not sure about OS).

This will put a cursor on each match, allowing you to edit them as you like. ESC will take you to the original cursor.

I don’t understand what you mean by “invert the marks”. It’s possible to find all as above and then invert the selection via the Selection menu (you can create a command or binding if it’s something you use often). Or have I misunderstood?

Alex[/quote]

Lovely… Needed to use the expand selection to line command and I needed to get ST3 for the “invert selection”. But now I’m good.
Thanks!

0 Likes

#4

Cool. Expand selection to line is Ctrl+L in Win/Linux which is another very useful shortcut. As I said, you can also bind invert selection (I didn’t recall it was only available in ST3) to somthing if you use it. Finally, if this is something you do often enough you can bundle together multiple commands as macros. (You could feasibly create one to select the word under the cursor, find all, expand selection and cut.) It would probably be overkill to bind this, but you can create a command with a memorable name to access it quickly.

0 Likes

#5

Right- good additional tips, thanks! I am getting familiarized with macros too. Now if there were a means to bind macros to keys w/o manually editing the sublime-keymap file :wink:

0 Likes

#6

Yeah, I know what you mean.

It feels like a huge hassle in the beginning, but you won’t need as many as you think – at least I didn’t:
github.com/alehandrof/sublime-s … ime-keymap

And on the upside, once you set these up and sync across your setups, you’ll forget all about them.

Alex

0 Likes

#7

[quote=“quodlibet”]

Yeah, I know what you mean.

It feels like a huge hassle in the beginning, but you won’t need as many as you think – at least I didn’t:
github.com/alehandrof/sublime-s … ime-keymap

And on the upside, once you set these up and sync across your setups, you’ll forget all about them.

Alex[/quote]

Thanks Alex. I will look at your mappings and see how best to use them. Regards

0 Likes