{"id":27992826,"url":"https://github.com/oxy2dev/patterns.nvim","last_synced_at":"2025-05-08T18:43:06.607Z","repository":{"id":277197888,"uuid":"931653974","full_name":"OXY2DEV/patterns.nvim","owner":"OXY2DEV","description":"A simple pattern viewer for Neovim with support for Lua patterns \u0026 regex.","archived":false,"fork":false,"pushed_at":"2025-04-20T08:14:52.000Z","size":1822,"stargazers_count":87,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-20T08:28:14.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OXY2DEV.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-12T16:31:20.000Z","updated_at":"2025-04-20T08:14:45.000Z","dependencies_parsed_at":"2025-02-12T17:39:41.193Z","dependency_job_id":"5c99c923-3ad3-41d1-acf6-7bf7651339d5","html_url":"https://github.com/OXY2DEV/patterns.nvim","commit_stats":null,"previous_names":["oxy2dev/patterns.nvim"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OXY2DEV%2Fpatterns.nvim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OXY2DEV%2Fpatterns.nvim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OXY2DEV%2Fpatterns.nvim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OXY2DEV%2Fpatterns.nvim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OXY2DEV","download_url":"https://codeload.github.com/OXY2DEV/patterns.nvim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253131726,"owners_count":21859058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-08T18:43:04.848Z","updated_at":"2025-05-08T18:43:06.596Z","avatar_url":"https://github.com/OXY2DEV.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧩 patterns.nvim\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg alt=\"Neovim\" src=\"https://img.shields.io/badge/Neovim-000?style=for-the-badge\u0026logo=neovim\u0026logoColor=A6E3A1\u0026color=1E1E2E\"\u003e\n    \u003cimg alt=\"Repo size\" src=\"https://img.shields.io/github/languages/code-size/OXY2DEV/patterns.nvim?style=for-the-badge\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0%2BPHBhdGggc3Ryb2tlPSIjQ0JBNkY3IiBmaWxsPSIjQ0JBNkY3IiBkPSJNOTYgMEM0MyAwIDAgNDMgMCA5NkwwIDQxNmMwIDUzIDQzIDk2IDk2IDk2bDI4OCAwIDMyIDBjMTcuNyAwIDMyLTE0LjMgMzItMzJzLTE0LjMtMzItMzItMzJsMC02NGMxNy43IDAgMzItMTQuMyAzMi0zMmwwLTMyMGMwLTE3LjctMTQuMy0zMi0zMi0zMkwzODQgMCA5NiAwem0wIDM4NGwyNTYgMCAwIDY0TDk2IDQ0OGMtMTcuNyAwLTMyLTE0LjMtMzItMzJzMTQuMy0zMiAzMi0zMnptMzItMjQwYzAtOC44IDcuMi0xNiAxNi0xNmwxOTIgMGM4LjggMCAxNiA3LjIgMTYgMTZzLTcuMiAxNi0xNiAxNmwtMTkyIDBjLTguOCAwLTE2LTcuMi0xNi0xNnptMTYgNDhsMTkyIDBjOC44IDAgMTYgNy4yIDE2IDE2cy03LjIgMTYtMTYgMTZsLTE5MiAwYy04LjggMC0xNi03LjItMTYtMTZzNy4yLTE2IDE2LTE2eiIvPjwvc3ZnPg%3D%3D\u0026logoColor=CBA6F7\u0026labelColor=1e1e2e\u0026color=B4BEFE\"\u003e\n    \u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/OXY2DEV/patterns.nvim?include_prereleases\u0026sort=semver\u0026display_name=release\u0026style=for-the-badge\u0026logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0%2BPHBhdGggZmlsbD0iI0Y1RTBEQyIgc3Ryb2tlPSIjRjVFMERDIiBkPSJNMzQ1IDM5LjFMNDcyLjggMTY4LjRjNTIuNCA1MyA1Mi40IDEzOC4yIDAgMTkxLjJMMzYwLjggNDcyLjljLTkuMyA5LjQtMjQuNSA5LjUtMzMuOSAuMnMtOS41LTI0LjUtLjItMzMuOUw0MzguNiAzMjUuOWMzMy45LTM0LjMgMzMuOS04OS40IDAtMTIzLjdMMzEwLjkgNzIuOWMtOS4zLTkuNC05LjItMjQuNiAuMi0zMy45czI0LjYtOS4yIDMzLjkgLjJ6TTAgMjI5LjVMMCA4MEMwIDUzLjUgMjEuNSAzMiA0OCAzMmwxNDkuNSAwYzE3IDAgMzMuMyA2LjcgNDUuMyAxOC43bDE2OCAxNjhjMjUgMjUgMjUgNjUuNSAwIDkwLjVMMjc3LjMgNDQyLjdjLTI1IDI1LTY1LjUgMjUtOTAuNSAwbC0xNjgtMTY4QzYuNyAyNjIuNyAwIDI0Ni41IDAgMjI5LjV6TTE0NCAxNDRhMzIgMzIgMCAxIDAgLTY0IDAgMzIgMzIgMCAxIDAgNjQgMHoiLz48L3N2Zz4%3D\u0026labelColor=1E1E2E\u0026color=45475A\"\u003e\n\u003c/div\u003e\n\n\u003cimg src=\"https://github.com/OXY2DEV/patterns.nvim/blob/images/repo/patterns-demo_1.png\"\u003e\n\u003cimg src=\"https://github.com/OXY2DEV/patterns.nvim/blob/images/repo/patterns-demo_2.png\"\u003e\n\u003cimg src=\"https://github.com/OXY2DEV/patterns.nvim/blob/images/repo/patterns-demo_3.png\"\u003e\n\u003cimg src=\"https://github.com/OXY2DEV/patterns.nvim/blob/images/repo/patterns-demo_4.png\"\u003e\n\nA simple pattern explainer \u0026 editor for Neovim.\n\n## 📖 Table of contents\n\n- [✨ Features](#-features)\n- [📚 Requirements](#-requirements)\n- [📐 Installation](#-installation)\n- [🧭 Configuration](#-configuration)\n- [💡 Commands](#-commands)\n- [🎹 keymaps](#-keymaps)\n\n## ✨ Features\n\n- Tree-sitter based pattern explainer.\n- LSP-like hover window for strings.\n- A real-time pattern editor \u0026 matcher.\n- Support for multiple pattern languages,\n\n    + `regex`\n    + `lua_patterns`(requires custom parser)\n\n- Highly configurable! Almost everything can be configured(without needing to leave your editor).\n\n## 📚 Requirements\n\n- Tree-sitter parser.\n\n    + `regex`(install through `nvim-treesitter` via `:TSInstall regex`)\n    + `lua_patterns`(optional, See [parser installation](https://github.com/OXY2DEV/tree-sitter-lua_patterns?tab=readme-ov-file#-installation)).\n\n- A tree-sitter supported colorscheme(optional).\n- A nerd font.\n\n- Node.js(optional, needed if you use javascript's regexp).\n\n## 📐 Installation\n\n### 🧩 Vim-plug\n\nAdd this to your plugin list.\n\n```vim\nPlug \"OXY2DEV/patterns.nvim\"\n```\n\n### 💤 lazy.nvim\n\n\u003e[!NOTE]\n\u003e Lazy loading is NOT needed for this plugin!\n\nFor `plugins.lua` users,\n\n```lua\n{\n    \"OXY2DEV/patterns.nvim\",\n},\n```\n\nFor `plugins/patterns.lua`,\n\n```lua\nreturn {\n    \"OXY2DEV/patterns.nvim\",\n};\n```\n\n## 🦠 mini.deps\n\n```lua\nlocal MiniDeps = require(\"mini.deps\");\n\nMiniDeps.add({\n    source = \"OXY2DEV/patterns.nvim\"\n});\n```\n\n### 🌒 Rocks.nvim\n\n\u003e[!WARNING]\n\u003e `luarocks package` may sometimes be a bit behind `main`.\n\n```vim\n:Rocks install patterns.nvim\n```\n\n### 📥 GitHub release\n\nTagged releases can be found in the [release page](https://github.com/OXY2DEV/patterns.nvim/releases).\n\n\u003e[!NOTE]\n\u003e `Github releases` may sometimes be slightly behind `main`.\n\n## 🧭 Configuration\n\nSee the default configuration [here](https://github.com/OXY2DEV/patterns.nvim/blob/main/lua/patterns/spec.lua#L8-#L602).\n\n\u003cdetails\u003e\n    \u003csummary\u003eShow type definitions\u003c/summary\u003e\n\n```lua\n--- Configuration for `patterns.nvim`.\n---@class patterns.config\n---\n--- WARNING, This just changes the priority\n--- of the matchers.\n--- Both matchers will be tried!\n---@field preferred_regex_matcher\n---| \"node\" Allows matching Javascript's regexp.\n---| \"vim\" Allows matching Vim's regexp.\n---\n--- Delay for updating explainer UI.\n---@field update_delay integer\n---\n---@field keymaps? patterns.keymaps\n---@field windows patterns.windows\n---@field lua_patterns patterns.lua_patterns\n---@field regex patterns.regex\n\n---@class patterns.keymaps\n---\n---@field hover table\u003cstring, patterns.keymap_opts\u003e\n---@field explain_input table\u003cstring, patterns.keymap_opts\u003e\n---@field explain_preview table\u003cstring, patterns.keymap_opts\u003e\n\n\n--- Action names for the explainer.\n---@alias explain_actions\n---| \"toggle\" Toggle focus of window.\n---| \"mode_change\" Switches between the explainer \u0026 the matcher.\n---\n--- Changes pattern language backwards.\n---| \"lang_prev\"\n---| \"lang_next\" Changes pattern language forwards.\n---\n--- Closes explainer.\n---| \"close\"\n---| \"apply\" Applies changes.\n\n\n--- Action names for the hover.\n---@alias hover_actions\n---| \"close\" Closes hover window.\n---| \"edit\" Edit pattern.\n\n---@class patterns.keymap_opts\n---\n---@field desc? string\n---@field callback explain_actions | hover_actions | function\n\n\n--- Window configurations for various\n--- windows.\n---@class patterns.windows\n---\n---@field hover? table | fun(q1: \"left\" | \"right\" | \"center\", q2: \"top\" | \"bottom\" | \"center\"): table\n---\n---@field input? table | fun(): table\n---@field preview? table | fun(): table\n\n\n--- Options for Lua patterns.\n--- Option name matches the tree-sitter node name.\n---@class patterns.lua_patterns\n---\n---@field indent_size integer Indentation size.\n---@field indent_marker string Marker used for indentation.\n---@field indent_hl? string Highlight group for the indentation markers.\n---\n---@field pattern pattern_item.opts\n---\n---@field anchor_start pattern_item.opts\n---@field anchor_end pattern_item.opts\n---\n---@field quantifier_optional pattern_item.opts\n---@field quantifier_minus pattern_item.opts\n---@field quantifier_plus pattern_item.opts\n---@field quantifier_star pattern_item.opts\n---\n---@field literal_character pattern_item.opts\n---@field any_character pattern_item.opts\n---@field escape_sequence pattern_item.opts\n---@field escaped_character pattern_item.opts\n---\n---@field capture_group pattern_item.opts\n---@field character_set pattern_item.opts\n---@field character_set_content pattern_item.opts\n---@field character_range pattern_item.opts\n---@field character_class pattern_item.opts\n\n\n--- Options for Regex.\n--- Option name matches the tree-sitter node name.\n---@class patterns.regex\n---\n---@field indent_size integer Indentation size.\n---@field indent_marker string Marker used for indentation.\n---@field indent_hl? string Highlight group for the indentation markers.\n---\n---@field pattern pattern_item.opts\n---@field alternation pattern_item.opts\n---@field term pattern_item.opts\n---\n---@field start_assertion pattern_item.opts\n---@field end_assertion pattern_item.opts\n---@field boundary_assertion pattern_item.opts\n---@field non_boundary_assertion pattern_item.opts\n---@field lookaround_assertion pattern_item.opts\n---\n---@field quantifier_count pattern_item.opts\n---@field quantifier_optional pattern_item.opts\n---@field quantifier_plus pattern_item.opts\n---@field quantifier_star pattern_item.opts\n---\n---@field pattern_character pattern_item.opts\n---@field class_character pattern_item.opts\n---@field any_character pattern_item.opts\n---@field decimal_escape pattern_item.opts\n---@field character_class_escape pattern_item.opts\n---@field unicode_character_escape pattern_item.opts\n---@field unicode_property_value pattern_item.opts\n---@field control_escape pattern_item.opts\n---@field control_letter_escape pattern_item.opts\n---@field identity_escape pattern_item.opts\n---@field backreference_escape pattern_item.opts\n---@field unicode_property_value_expression pattern_item.opts\n---\n---@field character_class pattern_item.opts\n---@field posix_character_class pattern_item.opts\n---@field named_group_backreference pattern_item.opts\n---@field capturing_group pattern_item.opts\n---@field non_capturing_group pattern_item.opts\n---\n---@field flags_group pattern_item.opts\n---@field flags pattern_item.opts\n\n\n--- Options for each node type.\n---@class pattern_item.opts\n---\n--- Can be set to `false` to disable rendering of \n--- a specific node type.\n---@field enable? boolean | fun(buffer: integer, item: __patterns.item): boolean\n---\n--- Can be set to `true` to show the range of a\n--- node.\n---@field show_range? boolean | fun(buffer: integer, item: __patterns.item): boolean\n---\n--- Highlight group for the text.\n---@field text_hl? string | fun(buffer: integer, item: __patterns.item): string?\n---\n--- Text to show for a node.\n---@field text? string | fun(buffer: integer, item: __patterns.item): string\n---\n--- When set to `true`, shows tooltip for nodes.\n--- By default this only shows tips for the current\n--- node.\n---@field show_tip? boolean | fun(buffer: integer, item: __patterns.item): boolean\n---\n--- Highlight group for the tooltip text.\n---@field tip_hl? string | fun(buffer: integer, item: __patterns.item): string\n---\n--- Number of spaces to add before tooltip text.\n--- This is added AFTER the indentation.\n---@field tip_offset? integer | fun(buffer: integer, item: __patterns.item): integer\n---\n--- Highlight group for the node range.\n---@field range_hl? string | fun(buffer: integer, item: __patterns.item): string?\n---\n--- Bade highlight group. Used by other *_hl\n--- options when they don't have a value.\n---@field hl? string | fun(buffer: integer, item: __patterns.item): string?\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n    \u003csummary\u003eShow default configuration\u003c/summary\u003e\n\n```lua\nspec.default = {\n    preferred_regex_matcher = \"vim\",\n    update_delay = 150,\n\n    keymaps = {\n        explain_input = {\n            [\"\u003cCR\u003e\"] = {\n                callback = \"apply\"\n            },\n            [\"q\"] = {\n                callback = \"close\"\n            },\n\n            [\"\u003ctab\u003e\"] = {\n                callback = \"toggle\"\n            },\n\n            [\"H\"] = {\n                callback = \"lang_prev\"\n            },\n            [\"L\"] = {\n                callback = \"lang_next\"\n            },\n        },\n        explain_preview = {\n            [\"q\"] = {\n                callback = \"close\"\n            },\n\n            [\"\u003ctab\u003e\"] = {\n                callback = \"toggle\"\n            },\n\n            [\"T\"] = {\n                callback = \"mode_change\"\n            }\n        },\n\n        hover = {\n            [\"q\"] = {\n                callback = \"close\"\n            },\n            [\"i\"] = {\n                callback = \"edit\"\n            }\n        }\n    },\n    windows = {\n        hover = function (q1, q2)\n            local border = { \"╭\", \"─\", \"╮\", \"│\", \"╯\", \"─\", \"╰\", \"│\" };\n\n            if q2 == \"top\" then\n                if q1 == \"left\" then\n                    border[5] = \"┤\";\n                elseif q1 == \"right\" then\n                    border[7] = \"├\";\n                end\n            elseif q2 == \"bottom\" then\n                if q1 == \"left\" then\n                    border[3] = \"┤\";\n                elseif q1 == \"right\" then\n                    border[1] = \"├\";\n                end\n            end\n\n            local ft;\n\n            if package.loaded[\"patterns.hover\"] and package.loaded[\"patterns.hover\"].buf then\n                ft = vim.bo[package.loaded[\"patterns.hover\"].buf].ft;\n            end\n\n            return {\n                width = math.floor(vim.o.columns * 0.6),\n                height = math.floor(vim.o.lines * 0.5),\n\n                border = border,\n\n                footer_pos = \"right\",\n                footer = {\n                    { \"╸\", \"FloatBorder\" },\n                    { \" 󰛪 \" .. (ft or \"Patterns\") .. \" \", \"FloatBorder\" },\n                    { \"╺\", \"FloatBorder\" },\n                }\n            }\n        end\n    },\n\n    lua_patterns = {\n        indent_size = 2,\n        indent_marker = \"│\",\n        indent_hl = \"PatternsPalette0Fg\",\n\n        pattern = {\n            text = \"󰐱 Pattern\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette0Bg\",\n            hl = \"PatternsPalette0\";\n        },\n\n        ----------------------------------------\n\n        anchor_start = {\n            text = \"󰾺 From start\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        anchor_end = {\n            text = \"󰾸 To end\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        ----------------------------------------\n\n        quantifier_minus = {\n            text = \"󰑖 Zero or more times(non-greedily)\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_optional = {\n            text = \"󰑘 Zero or one time\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_plus = {\n            text = \"󰑘 One or more times\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_star = {\n            text = \"󰑖 Zero or more times(greedily)\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        ----------------------------------------\n\n        literal_character = {\n            text = function (_, item)\n                if item.text == \"\\\\\" then\n                    return '󱄽 Character: \"\\\\\"';\n                else\n                    return string.format(\"󱄽 Character: %s\", vim.inspect(item.text));\n                end\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette4Bg\",\n            hl = \"PatternsPalette4\"\n        },\n\n        any_character = {\n            text = \" Any character\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        escape_sequence = {\n            text = function (_, item)\n                return string.format('󰩈 Escape sequence: \"%s\"', item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        escaped_character = {\n            text = function (_, item)\n                return string.format('󰩈 Escaped character: \"%s\"', item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        ----------------------------------------\n\n        capture_group = {\n            text = function (_, item)\n                return string.format(\" Capture group, 󱤬 %d\", item.id or -1);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        character_set = {\n            text = \"󱉓 Character set\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette3Bg\",\n            hl = \"PatternsPalette3\"\n        },\n\n        character_set_content = {\n            text = \"󰆦 Character set content,\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        character_range = {\n            text = function (_, item)\n                return string.format(\"󰊱 Character range: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        character_class = {\n            text = function (_, item)\n                return \"󰏗 Character class: \" .. vim.inspect(item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette4Bg\",\n            hl = \"PatternsPalette4\"\n        },\n    },\n\n    regex = {\n        indent_size = 2,\n        indent_marker = \"│\",\n        indent_hl = \"PatternsPalette0Fg\",\n\n        pattern = {\n            text = \"󰛪 Pattern\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette0Bg\",\n            hl = \"PatternsPalette0\"\n        },\n\n        alternation = {\n            text = \"󰋰 Alternative pattern(s)\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        term = {\n            text = function (_, item)\n                return string.format(\"󰊲 Regex term(#%d)\", item.id or -1);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        ----------------------------------------\n\n        start_assertion = {\n            text = \"󰾺 From start\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        end_assertion = {\n            text = \"󰾸 To end\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        boundary_assertion = {\n            text = \"󰕤 Match as a word\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        non_boundary_assertion = {\n            text = \"󰕛 Match as part of a word\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        lookaround_assertion = {\n            text = function (_, item)\n                if string.match(item.text, \"^%(%?%\u003c\") then\n                    return \"󰡭 Look behind\";\n                else\n                    return \"󰡮 Look ahead\";\n                end\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette3Bg\",\n            hl = \"PatternsPalette3\"\n        },\n\n        ----------------------------------------\n\n        quantifier_count = {\n            text = function (_, item)\n                if string.match(item.text, \"^%d+$\") then\n                    return string.format(\" Repeats exactly %s times\", item.text);\n                elseif string.match(item.text, \"^%d+,$\") then\n                    return string.format(\n                        \" Repeats at least %s times\",\n                        string.match(item.text, \"^(%d+)\")\n                    );\n                elseif string.match(item.text, \"^,%d+$\") then\n                    return string.format(\n                        \" Repeats at most %s times\",\n                        string.match(item.text, \"^,(%d+)$\")\n                    );\n                else\n                    return string.format(\n                        \" Repeats between %s \u0026 %s times\",\n                        string.match(item.text, \"^(%d+),\"),\n                        string.match(item.text, \"^%d+,(%d+)$\")\n                    );\n                end\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_optional = {\n            text = \" Repeats zero or one time\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_plus = {\n            text = \" Repeats one or more times\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        quantifier_star = {\n            text = \" Repeats zero or more times\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette7Bg\",\n            hl = \"PatternsPalette7\"\n        },\n\n        ----------------------------------------\n\n        pattern_character = {\n            text = function (_, item)\n                return string.format(\"󱄽 Character: %s\", vim.inspect(item.text));\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette2Bg\",\n            hl = \"PatternsPalette2\"\n        },\n\n        class_character = {\n            text = function (_, item)\n                return string.format(\"󱄽 Character: %s\", vim.inspect(item.text));\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette2Bg\",\n            hl = \"PatternsPalette2\"\n        },\n\n        any_character = {\n            text = \" Any character\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        decimal_escape = {\n            text = function (_, item)\n                return string.format(\"󰩈 Decimal escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        character_class_escape = {\n            text = function (_, item)\n                return string.format(\"󰩈 Character class escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        unicode_character_escape = {\n            text = function (_, item)\n                return string.format(\"󰩈 Unicode character escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        unicode_property_value = {\n            text = function (_, item)\n                return string.format(\"󰗊 Unicode property value: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette6Bg\",\n            hl = \"PatternsPalette6\"\n        },\n\n        control_escape = {\n            text = function (_, item)\n                return string.format(\"󰁨 Control character escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        control_letter_escape = {\n            text = function (_, item)\n                return string.format(\"󰁨 Control letter escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        identity_escape = {\n            text = function (_, item)\n                return string.format(\"󰩈 Identity escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        backreference_escape = {\n            text = function (_, item)\n                return string.format(\"󰒻 Backreference escape: %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette1Bg\",\n            hl = \"PatternsPalette1\"\n        },\n\n        ----------------------------------------\n\n        unicode_property_value_expression = {\n            text = \"󰁀 Unicode property value expression\",\n            show_tip = on_current,\n\n            -- show_content = true,\n            tip_hl = \"PatternsPalette0Bg\",\n            hl = \"PatternsPalette0\"\n        },\n\n        ----------------------------------------\n\n        character_class = {\n            text = \"󰏗 Character class\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette4Bg\",\n            hl = \"PatternsPalette4\"\n        },\n\n        posix_character_class = {\n            text = function (_, item)\n                return string.format(\"󰏗 POSIX Character class: \", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        named_group_backreference = {\n            text = function (_, item)\n                return string.format(\"󰒻 Named backreference: \", string.match(item.text, \"^%(%?P%=(.-)%)$\"));\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        capturing_group = {\n            text = function (_, item)\n                if type(item.id) == \"string\" then\n                    return string.format(\"󱉶 Capture group(#%s)\", item.id or \"???\");\n                else\n                    return string.format(\"󱉶 Capture group(#%d)\", item.id or -1);\n                end\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        non_capturing_group = {\n            text = function (_, item)\n                return string.format(\"󰒉 Non-capture group(#%d)\", item.id or -1);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette5Bg\",\n            hl = \"PatternsPalette5\"\n        },\n\n        flags_group = {\n            text = \"󰂖 Flags group\",\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette2Bg\",\n            hl = \"PatternsPalette2\"\n        },\n\n        flags = {\n            text = function (_, item)\n                return string.format(\"󰈻 Flag(s): %s\", item.text);\n            end,\n            show_tip = on_current,\n\n            tip_hl = \"PatternsPalette2Bg\",\n            hl = \"PatternsPalette2\"\n        },\n    }\n};\n```\n\n\u003c/details\u003e\n\n\n## 💡 Commands\n\nThis plugin creates the `:Patterns` command. It has 2 sub-commands,\n\n- `explain`\n  Explains the pattern under the cursor.\n\n- `hover`\n  LSP-like hover for the pattern under cursor.\n  It's behavior is similar to `K`(or `vim.lsp.buf.hover()`).\n\nWhen `:Patterns` is run without any arguments, it opens the explain window.\n\n## 🎹 keymaps\n\nThe `hover` \u0026 `explain` buffers have some pre-defined keymaps.\n\n\u003e[!TIP]\n\u003e You can disable these keymaps individually via the config.\n\u003e\n\u003e ```lua\n\u003e {\n\u003e   keymaps = {\n\u003e     hover = {\n\u003e       [\"i\"] = { enable = false }\n\u003e     }\n\u003e   }\n\u003e }\n\u003e ```\n\n### ⭐ hover\n\nThe hover buffer has the following keymaps,\n\n+ `q`\n  Closes hover window.\n\n+ `i`\n  Opens the pattern inside the explainer.\n\n\n### ⭐ explain\n\n#### ⭐ explain_input\n\nThe text input buffer has the following keymaps,\n\n+ `\u003cCR\u003e`\n  Replaces the pattern under cursor with the text in the input buffer.\n\n+ `q`\n  Quits the explainer.\n\n+ `\u003ctab\u003e`\n  Switches to the explanation/preview buffer.\n\n+ `H`\n  Cycles backward through the list of supported languages(lua_patterns, regex).\n\n+ `L`\n  Cycles forward through the list of supported languages(lua_patterns, regex).\n\n#### ⭐ explain_preview\n\nThe pattern preview/explanation buffer has the following keymaps,\n\n+ `q`\n  Quits the explainer.\n\n+ `\u003ctab\u003e`\n  Switches to the input buffer.\n\n+ `T`\n  Toggles between the explanation and the matcher.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxy2dev%2Fpatterns.nvim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxy2dev%2Fpatterns.nvim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxy2dev%2Fpatterns.nvim/lists"}