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

File Filter

by vsc-cnst ST4

Sublime Text plugin for filtering file content using regular expressions

Details

Installs

  • Total 458
  • Win 262
  • Mac 139
  • Linux 57
Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9
Windows 0 0 0 0 0 1 3 0 0 0 0 1 1 3 0 0 0 0 0 6 0 1 4 0 1 3 1 1 2 3 3 1 0 0 0 0 0 1 1 0 2 0 0 0 0 0
Mac 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 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 1 0 2

Readme

Source
raw.​githubusercontent.​com

File Filter Plugin for Sublime Text

Overview

File Filter highlights regex matches and folds non-matching content without modifying the original file.

It is useful when you want to quickly isolate relevant lines or sections in large log files, source code, or text dumps.

Features

  • Regex-based filtering
  • Create a filter from selected text
  • Highlight styles for matches
  • Folding strategies for non-matching content
  • Favorite presets
  • History

Table of contents

Installation

  1. Open the Command Palette.
  2. Run Package Control: Install Package.
  3. Search for File Filter and install it.

Commands

File Filter Command

  1. Open the Command Palette.
  2. Select File Filter.
  3. Choose one of the available options:
Option Description
New Opens a regex prompt to create a new search pattern.
From Selected Text Uses the current selection as the search pattern.
History Restores a previously used regex from the current view history and applies it immediately.
Favorites Applies a saved preset from the favorites list to the current view.
Clear Clears the current filter, equivalent to the Clear command.

Set Folding Style Command

Adjust how content collapses around matches for better readability.

  1. Open the Command Palette.
  2. Select File Filter: Folding Style.

Options: - line: Show the entire line while hiding lines with no matches. - match_only: Show only the matched text. - before_only: Fold all text before the match and show only the matching lines. - after_only: Fold text after the match and hide lines with no matches. - highlight_only: Highlight the matched text without folding or hiding any content.

Set Highlight Style Command

Adjust how matched text is highlighted.

  1. Open the Command Palette.
  2. Select File Filter: Highlight Style.

Options: - solid: Highlight with a solid fill. - outline: Highlight with an outline and no fill. - underline_solid: Highlight with a solid underline and no fill or outline. - underline_stippled: Highlight with a stippled underline and no fill or outline. - underline_squiggly: Highlight with a squiggly underline and no fill or outline. - none: Disable highlighting.

Clear Command

Clear all active filters.

  1. Open the Command Palette.
  2. Select File Filter: Clear.

Edit Settings Command

Open the plugin settings file.

  1. Open the Command Palette.
  2. Select File Filter: Edit Settings.

Regex syntax

For additional information on valid syntax and options, follow the Python regex documentation.

Flags:

Flags: use the (?aiLmsux-imsx:...) syntax to add flags.

  • Using PYTHON (the same as (?:PYTHON)), the filter will match lines with PYTHON.

  • Using (?i:PYTHON), the filter will match lines with python, Python, PYTHON…

  • Using (?:PYTHON)outer, the filter will match PYTHONouter.

Settings

{
    "global": {
        // minimum log level
        "log_level": 30,

        // default global regex
        "global_regex_flags": "gi"
    },
    "defaults": {
        // default highlight settings
        "highlight": {
            "type": "solid" // 'solid', 'outline', 'underline_solid', 'underline_stippled', 'underline_squiggly', 'none'
        },
        // default folding settings
        "folding": {
            "type": "line" // 'line', 'match_only', 'before_only', 'after_only', 'highlight_only'
        }
    },
    "commands": {
        "new": {
            // filter every time the prompt changes
            "filter_on_change": true,
            "show_total_matches": true
        },
        "from_selection": {
            // escape selected text to create the regex
            "escape_selection": true
        },
        "clear": {
            // keep the current setting name exactly as used by the plugin
            "center_viewport_on_carret": true,
            "remove_highlights": true,
            "unfold_regions": true
        }
    },
    // list shown in the favorites command
    "favorites": [
        {
            // avoid repeated codes
            "code": "logs-info",
            "name": "logs info",
            "pattern": "\\[INF]"
        }
    ]
}