ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Find​In​Files-addon

by kaste ST4

Add-on for Sublime Text's Find-In-Files-feature

Labels find, add-on

Details

Installs

  • Total 28
  • Win 14
  • Mac 12
  • Linux 2
Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16
Windows 0 1 1 1 0 1 1 0 0 0 0 0 1 1 3 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 1 0 2 0 0 0 1 0 0 1 0 1 2 1 1 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Text - Find in Files hacks

The plugin with the following features:

  1. Make all lines in a find-in-files result buffer double-clickable.

  2. Bind <enter> to do the same thing, namely go to that line. (But also set the column, well … just the complete selection.)

  3. Bind , and . to go to the previous or next match staying in the result buffer. Just move the cursor (“navigate”) around. Wraps at the edges but stays in the same search. [1]

    But you can also bind fif_addon_prev_match and fif_addon_next_match on your own.

  4. Bind ctrl+r[2] to refresh the view, t.i. redo the last search. Hm, :thinking:, maybe we can change that and redo the search the cursor is currently in. But for now it is the last search in the buffer.

  5. Bind alt+c[3] to toggle case sensitivity, alt-w to toggle the whole word flag and redo the search immediately.

  6. Bind alt+r to toggle regex mode. The pattern will be escaped/unescaped and the panel will open to edit the pattern further.

  7. Bind + and - to change the number of context lines. For ease of use, hit - repeatedly as a toggle between no context and your default, or if your default is no context between that and some context.

  8. If you reuse the result buffer (and it is a tab, not the panel thing at the bottom of the window), the tab moves with you so that closing the tab (aka ctrl+w) brings you to the view where you initiated the search.

  9. Add the search summary (e.g. “2 matches across 2 files”) to the search header line (“Searching 9 files for …”)

  10. Re-bind ctrl+shift+f to immediately do the search if you have exactly one selection. Exclude untitled buffers in that case. (You can turn this off by setting "leave_my_keys_alone.FindInFiles-addon": true in the user preferences.) Sets “whole_word” if you've selected a whole word, unsets it if that's not the case. Also normalizes case_sensitive and regex to false.

[1] You know, the result buffer can be re-used and then holds the results of multiple searches.

[2] On Linux and Windows, F5 can be used as well.

[3] On Mac, the standard super+alt modifier is used.

I personally like it when escape closes the results view. You can add that to your own key bindings. E.g.

{
        "keys": ["escape"],
        "command": "close",
        "context": [
            { "key": "selector", "operand": "text.find-in-files" },
            // negate all default escape contexts, even if they're not likely to ever match
            { "key": "auto_complete_visible", "operator": "not_equal" },
            { "key": "has_prev_field", "operator": "not_equal" },
            { "key": "has_next_field", "operator": "not_equal" },
            { "key": "num_selections", "operator": "equal", "operand": 1 },
            { "key": "overlay_visible", "operator": "not_equal" },
            { "key": "panel_visible", "operator": "not_equal" },
            { "key": "popup_visible", "operator": "not_equal" },
        ]
    }