Sublime Forum

How to kill "Find in selection" with fire?

#1

Hi.

In Sublime Text 2, if I have several lines of text selected, and hit cmd-F, the default search will be a “search for whatever you type in the selection.”

While I can change this behavior by clicking the little “in selection” button, as a practical matter in 20 years of software development I’ve never, ever, ever wanted this feature while using a text editor: if I’m hitting cmd-F in a file, it’s because I want to search the whole file. Is there some setting I can put in my user prefs to have the “in selection” flag for find always default to false?

Thanks.

0 Likes

#2

Edited:
There is a setting in ST3, but see robertcollier4’s answer for ST2.

0 Likes

#3

You could technically do it with a plug-in. I figured out the command to toggle in-selection via guess-and-test. Something like:

[code]import sublime, sublime_plugin

class ReplaceCustomCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command(“show_panel”, {“panel”: “replace”})
if(view.sel()[0] IS MULTILINE): # this is psuedo-code replace with logic that ST2 uses to decide if it will use in selection
self.window.run_command(“toggle_in_selection”)[/code]

0 Likes