Home Download Buy Blog Forum Support

How to kill "Find in selection" with fire?

How to kill "Find in selection" with fire?

Postby peterb on Mon Apr 22, 2013 9:40 pm

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.
peterb
 
Posts: 1
Joined: Mon Apr 22, 2013 9:38 pm

Re: How to kill "Find in selection" with fire?

Postby skuroda on Mon Apr 22, 2013 10:12 pm

Edited:
There is a setting in ST3, but see robertcollier4's answer for ST2.
Last edited by skuroda on Tue Apr 23, 2013 12:26 am, edited 1 time in total.
skuroda
 
Posts: 687
Joined: Fri Oct 05, 2012 8:11 am

Re: How to kill "Find in selection" with fire?

Postby robertcollier4 on Mon Apr 22, 2013 10:40 pm

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: Select all
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")
robertcollier4
 
Posts: 154
Joined: Sun Feb 24, 2013 5:37 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 23 guests