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 474
  • Win 269
  • Mac 144
  • Linux 61
Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 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
Windows 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 1 3 0 0 0 0 1 1 3 0 0
Mac 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 1
Linux 0 0 0 0 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

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]"
        }
    ]
}