retrovim 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.conda/retrovim.yaml +259 -0
- package/.conda/terax.icns +0 -0
- package/.conda/terax.ico +0 -0
- package/.conda/terax.png +0 -0
- package/.github/workflows/release.yml +95 -0
- package/.gitmodules +3 -0
- package/.npm/kanata_touchcursor.js +28 -0
- package/.npm/nvim.js +26 -0
- package/.npm/yazi.js +26 -0
- package/.npm/zsh.js +17 -0
- package/.pip/kanata_touchcursor/__init__.py +28 -0
- package/.pip/nvim/__init__.py +31 -0
- package/.pip/yazi/__init__.py +31 -0
- package/.pip/zsh/__init__.py +22 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +674 -0
- package/README.md +336 -0
- package/kanata/touchcursor.kbd +164 -0
- package/nvim/init.lua +813 -0
- package/nvim/plugins/mini.nvim/.github/DISCUSSION_TEMPLATE/q-a.yml +72 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/bug-report.yml +136 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/feature-request.yml +75 -0
- package/nvim/plugins/mini.nvim/.github/PULL_REQUEST_TEMPLATE.md +2 -0
- package/nvim/plugins/mini.nvim/.github/workflows/quality-control.yml +150 -0
- package/nvim/plugins/mini.nvim/.pre-commit-config.yaml +20 -0
- package/nvim/plugins/mini.nvim/.stylua.toml +7 -0
- package/nvim/plugins/mini.nvim/.styluaignore +1 -0
- package/nvim/plugins/mini.nvim/CHANGELOG.md +1894 -0
- package/nvim/plugins/mini.nvim/CODE_OF_CONDUCT.md +132 -0
- package/nvim/plugins/mini.nvim/CONTRIBUTING.md +331 -0
- package/nvim/plugins/mini.nvim/LICENSE +21 -0
- package/nvim/plugins/mini.nvim/MAINTAINING.md +330 -0
- package/nvim/plugins/mini.nvim/Makefile +51 -0
- package/nvim/plugins/mini.nvim/README.md +261 -0
- package/nvim/plugins/mini.nvim/TESTING.md +1011 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/README.md +35 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/benchmark.sh +56 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-alpha.lua +21 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-original.lua +17 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-starter.lua +18 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_empty.lua +4 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_starter-default.lua +7 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-alpha.lua +10 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-original.lua +7 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-starter.lua +20 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/install.sh +10 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/make_summary.py +68 -0
- package/nvim/plugins/mini.nvim/benchmarks/starter/startup-summary.md +10 -0
- package/nvim/plugins/mini.nvim/colors/miniautumn.lua +55 -0
- package/nvim/plugins/mini.nvim/colors/minicyan.lua +95 -0
- package/nvim/plugins/mini.nvim/colors/minischeme.lua +95 -0
- package/nvim/plugins/mini.nvim/colors/minispring.lua +53 -0
- package/nvim/plugins/mini.nvim/colors/minisummer.lua +49 -0
- package/nvim/plugins/mini.nvim/colors/miniwinter.lua +51 -0
- package/nvim/plugins/mini.nvim/colors/randomhue.lua +16 -0
- package/nvim/plugins/mini.nvim/doc/mini-ai.txt +889 -0
- package/nvim/plugins/mini.nvim/doc/mini-align.txt +923 -0
- package/nvim/plugins/mini.nvim/doc/mini-animate.txt +937 -0
- package/nvim/plugins/mini.nvim/doc/mini-base16.txt +285 -0
- package/nvim/plugins/mini.nvim/doc/mini-basics.txt +359 -0
- package/nvim/plugins/mini.nvim/doc/mini-bracketed.txt +622 -0
- package/nvim/plugins/mini.nvim/doc/mini-bufremove.txt +123 -0
- package/nvim/plugins/mini.nvim/doc/mini-clue.txt +760 -0
- package/nvim/plugins/mini.nvim/doc/mini-cmdline.txt +392 -0
- package/nvim/plugins/mini.nvim/doc/mini-colors.txt +880 -0
- package/nvim/plugins/mini.nvim/doc/mini-comment.txt +230 -0
- package/nvim/plugins/mini.nvim/doc/mini-completion.txt +477 -0
- package/nvim/plugins/mini.nvim/doc/mini-cursorword.txt +105 -0
- package/nvim/plugins/mini.nvim/doc/mini-deps.txt +590 -0
- package/nvim/plugins/mini.nvim/doc/mini-diff.txt +661 -0
- package/nvim/plugins/mini.nvim/doc/mini-doc.txt +434 -0
- package/nvim/plugins/mini.nvim/doc/mini-extra.txt +856 -0
- package/nvim/plugins/mini.nvim/doc/mini-files.txt +1018 -0
- package/nvim/plugins/mini.nvim/doc/mini-fuzzy.txt +160 -0
- package/nvim/plugins/mini.nvim/doc/mini-git.txt +425 -0
- package/nvim/plugins/mini.nvim/doc/mini-hipatterns.txt +489 -0
- package/nvim/plugins/mini.nvim/doc/mini-hues.txt +420 -0
- package/nvim/plugins/mini.nvim/doc/mini-icons.txt +508 -0
- package/nvim/plugins/mini.nvim/doc/mini-indentscope.txt +485 -0
- package/nvim/plugins/mini.nvim/doc/mini-input.txt +932 -0
- package/nvim/plugins/mini.nvim/doc/mini-jump.txt +202 -0
- package/nvim/plugins/mini.nvim/doc/mini-jump2d.txt +525 -0
- package/nvim/plugins/mini.nvim/doc/mini-keymap.txt +449 -0
- package/nvim/plugins/mini.nvim/doc/mini-map.txt +717 -0
- package/nvim/plugins/mini.nvim/doc/mini-misc.txt +431 -0
- package/nvim/plugins/mini.nvim/doc/mini-move.txt +181 -0
- package/nvim/plugins/mini.nvim/doc/mini-notify.txt +434 -0
- package/nvim/plugins/mini.nvim/doc/mini-nvim.txt +431 -0
- package/nvim/plugins/mini.nvim/doc/mini-operators.txt +472 -0
- package/nvim/plugins/mini.nvim/doc/mini-pairs.txt +346 -0
- package/nvim/plugins/mini.nvim/doc/mini-pick.txt +1535 -0
- package/nvim/plugins/mini.nvim/doc/mini-sessions.txt +239 -0
- package/nvim/plugins/mini.nvim/doc/mini-snippets.txt +1291 -0
- package/nvim/plugins/mini.nvim/doc/mini-splitjoin.txt +536 -0
- package/nvim/plugins/mini.nvim/doc/mini-starter.txt +618 -0
- package/nvim/plugins/mini.nvim/doc/mini-statusline.txt +361 -0
- package/nvim/plugins/mini.nvim/doc/mini-surround.txt +863 -0
- package/nvim/plugins/mini.nvim/doc/mini-tabline.txt +151 -0
- package/nvim/plugins/mini.nvim/doc/mini-test.txt +966 -0
- package/nvim/plugins/mini.nvim/doc/mini-trailspace.txt +91 -0
- package/nvim/plugins/mini.nvim/doc/mini-visits.txt +937 -0
- package/nvim/plugins/mini.nvim/logo.png +0 -0
- package/nvim/plugins/mini.nvim/lua/mini/ai.lua +2244 -0
- package/nvim/plugins/mini.nvim/lua/mini/align.lua +2076 -0
- package/nvim/plugins/mini.nvim/lua/mini/animate.lua +2127 -0
- package/nvim/plugins/mini.nvim/lua/mini/base16.lua +1752 -0
- package/nvim/plugins/mini.nvim/lua/mini/basics.lua +772 -0
- package/nvim/plugins/mini.nvim/lua/mini/bracketed.lua +2013 -0
- package/nvim/plugins/mini.nvim/lua/mini/bufremove.lua +283 -0
- package/nvim/plugins/mini.nvim/lua/mini/clue.lua +2096 -0
- package/nvim/plugins/mini.nvim/lua/mini/cmdline.lua +1182 -0
- package/nvim/plugins/mini.nvim/lua/mini/colors.lua +2483 -0
- package/nvim/plugins/mini.nvim/lua/mini/comment.lua +586 -0
- package/nvim/plugins/mini.nvim/lua/mini/completion.lua +2094 -0
- package/nvim/plugins/mini.nvim/lua/mini/cursorword.lua +311 -0
- package/nvim/plugins/mini.nvim/lua/mini/deps.lua +1660 -0
- package/nvim/plugins/mini.nvim/lua/mini/diff.lua +1938 -0
- package/nvim/plugins/mini.nvim/lua/mini/doc.lua +1371 -0
- package/nvim/plugins/mini.nvim/lua/mini/extra.lua +2290 -0
- package/nvim/plugins/mini.nvim/lua/mini/files.lua +3145 -0
- package/nvim/plugins/mini.nvim/lua/mini/fuzzy.lua +356 -0
- package/nvim/plugins/mini.nvim/lua/mini/git.lua +1737 -0
- package/nvim/plugins/mini.nvim/lua/mini/hipatterns.lua +1042 -0
- package/nvim/plugins/mini.nvim/lua/mini/hues.lua +2088 -0
- package/nvim/plugins/mini.nvim/lua/mini/icons.lua +2254 -0
- package/nvim/plugins/mini.nvim/lua/mini/indentscope.lua +1158 -0
- package/nvim/plugins/mini.nvim/lua/mini/init.lua +427 -0
- package/nvim/plugins/mini.nvim/lua/mini/input.lua +2183 -0
- package/nvim/plugins/mini.nvim/lua/mini/jump.lua +609 -0
- package/nvim/plugins/mini.nvim/lua/mini/jump2d.lua +1244 -0
- package/nvim/plugins/mini.nvim/lua/mini/keymap.lua +880 -0
- package/nvim/plugins/mini.nvim/lua/mini/map.lua +1709 -0
- package/nvim/plugins/mini.nvim/lua/mini/misc.lua +969 -0
- package/nvim/plugins/mini.nvim/lua/mini/move.lua +509 -0
- package/nvim/plugins/mini.nvim/lua/mini/notify.lua +938 -0
- package/nvim/plugins/mini.nvim/lua/mini/operators.lua +1349 -0
- package/nvim/plugins/mini.nvim/lua/mini/pairs.lua +657 -0
- package/nvim/plugins/mini.nvim/lua/mini/pick.lua +3876 -0
- package/nvim/plugins/mini.nvim/lua/mini/sessions.lua +689 -0
- package/nvim/plugins/mini.nvim/lua/mini/snippets.lua +2828 -0
- package/nvim/plugins/mini.nvim/lua/mini/splitjoin.lua +1132 -0
- package/nvim/plugins/mini.nvim/lua/mini/starter.lua +1599 -0
- package/nvim/plugins/mini.nvim/lua/mini/statusline.lua +686 -0
- package/nvim/plugins/mini.nvim/lua/mini/surround.lua +2388 -0
- package/nvim/plugins/mini.nvim/lua/mini/tabline.lua +564 -0
- package/nvim/plugins/mini.nvim/lua/mini/test.lua +2516 -0
- package/nvim/plugins/mini.nvim/lua/mini/trailspace.lua +215 -0
- package/nvim/plugins/mini.nvim/lua/mini/visits.lua +1577 -0
- package/nvim/plugins/mini.nvim/readmes/mini-ai.md +190 -0
- package/nvim/plugins/mini.nvim/readmes/mini-align.md +203 -0
- package/nvim/plugins/mini.nvim/readmes/mini-animate.md +214 -0
- package/nvim/plugins/mini.nvim/readmes/mini-base16.md +198 -0
- package/nvim/plugins/mini.nvim/readmes/mini-basics.md +184 -0
- package/nvim/plugins/mini.nvim/readmes/mini-bracketed.md +193 -0
- package/nvim/plugins/mini.nvim/readmes/mini-bufremove.md +139 -0
- package/nvim/plugins/mini.nvim/readmes/mini-clue.md +260 -0
- package/nvim/plugins/mini.nvim/readmes/mini-cmdline.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-colors.md +169 -0
- package/nvim/plugins/mini.nvim/readmes/mini-comment.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-completion.md +217 -0
- package/nvim/plugins/mini.nvim/readmes/mini-cursorword.md +137 -0
- package/nvim/plugins/mini.nvim/readmes/mini-deps.md +271 -0
- package/nvim/plugins/mini.nvim/readmes/mini-diff.md +289 -0
- package/nvim/plugins/mini.nvim/readmes/mini-doc.md +198 -0
- package/nvim/plugins/mini.nvim/readmes/mini-extra.md +158 -0
- package/nvim/plugins/mini.nvim/readmes/mini-files.md +247 -0
- package/nvim/plugins/mini.nvim/readmes/mini-fuzzy.md +134 -0
- package/nvim/plugins/mini.nvim/readmes/mini-git.md +168 -0
- package/nvim/plugins/mini.nvim/readmes/mini-hipatterns.md +176 -0
- package/nvim/plugins/mini.nvim/readmes/mini-hues.md +285 -0
- package/nvim/plugins/mini.nvim/readmes/mini-icons.md +183 -0
- package/nvim/plugins/mini.nvim/readmes/mini-indentscope.md +191 -0
- package/nvim/plugins/mini.nvim/readmes/mini-input.md +163 -0
- package/nvim/plugins/mini.nvim/readmes/mini-jump.md +161 -0
- package/nvim/plugins/mini.nvim/readmes/mini-jump2d.md +197 -0
- package/nvim/plugins/mini.nvim/readmes/mini-keymap.md +205 -0
- package/nvim/plugins/mini.nvim/readmes/mini-map.md +191 -0
- package/nvim/plugins/mini.nvim/readmes/mini-misc.md +145 -0
- package/nvim/plugins/mini.nvim/readmes/mini-move.md +163 -0
- package/nvim/plugins/mini.nvim/readmes/mini-notify.md +175 -0
- package/nvim/plugins/mini.nvim/readmes/mini-operators.md +193 -0
- package/nvim/plugins/mini.nvim/readmes/mini-pairs.md +158 -0
- package/nvim/plugins/mini.nvim/readmes/mini-pick.md +340 -0
- package/nvim/plugins/mini.nvim/readmes/mini-sessions.md +164 -0
- package/nvim/plugins/mini.nvim/readmes/mini-snippets.md +373 -0
- package/nvim/plugins/mini.nvim/readmes/mini-splitjoin.md +194 -0
- package/nvim/plugins/mini.nvim/readmes/mini-starter.md +176 -0
- package/nvim/plugins/mini.nvim/readmes/mini-statusline.md +155 -0
- package/nvim/plugins/mini.nvim/readmes/mini-surround.md +190 -0
- package/nvim/plugins/mini.nvim/readmes/mini-tabline.md +156 -0
- package/nvim/plugins/mini.nvim/readmes/mini-test.md +175 -0
- package/nvim/plugins/mini.nvim/readmes/mini-trailspace.md +137 -0
- package/nvim/plugins/mini.nvim/readmes/mini-visits.md +243 -0
- package/nvim/plugins/mini.nvim/scripts/dual_log.sh +13 -0
- package/nvim/plugins/mini.nvim/scripts/dual_push.sh +15 -0
- package/nvim/plugins/mini.nvim/scripts/dual_release.sh +102 -0
- package/nvim/plugins/mini.nvim/scripts/dual_sync.sh +115 -0
- package/nvim/plugins/mini.nvim/scripts/init-deps-example.lua +59 -0
- package/nvim/plugins/mini.nvim/scripts/lint-filename-length.sh +16 -0
- package/nvim/plugins/mini.nvim/scripts/lintcommit-ci.sh +18 -0
- package/nvim/plugins/mini.nvim/scripts/lintcommit.lua +393 -0
- package/nvim/plugins/mini.nvim/scripts/minidoc.lua +57 -0
- package/nvim/plugins/mini.nvim/scripts/minimal_init.lua +28 -0
- package/nvim/plugins/mini.nvim/scripts/minitest.lua +4 -0
- package/package.json +16 -0
- package/pyproject.toml +43 -0
- package/yazi/init.lua +12 -0
- package/yazi/keymap.toml +114 -0
- package/yazi/lesskey +5 -0
- package/yazi/plugins/bookmarks.yazi/main.lua +86 -0
- package/yazi/plugins/cd-git-root.yazi/main.lua +31 -0
- package/yazi/plugins/smart-enter.yazi/main.lua +11 -0
- package/yazi/theme.toml +26 -0
- package/yazi/yazi.toml +15 -0
- package/zsh/.zshrc +145 -0
- package/zsh/starship.toml +20 -0
- package/zsh/zsh-patina.toml +2 -0
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
*mini.hipatterns* Highlight patterns in text
|
|
2
|
+
|
|
3
|
+
MIT License Copyright (c) 2023 Evgeni Chasnovski
|
|
4
|
+
|
|
5
|
+
------------------------------------------------------------------------------
|
|
6
|
+
*MiniHipatterns*
|
|
7
|
+
Features:
|
|
8
|
+
- Highlight text with configurable patterns and highlight groups (can be
|
|
9
|
+
string or callable).
|
|
10
|
+
|
|
11
|
+
- Highlighting is updated asynchronously with configurable debounce delay.
|
|
12
|
+
|
|
13
|
+
- Function to get matches in a buffer (see |MiniHipatterns.get_matches()|).
|
|
14
|
+
|
|
15
|
+
See |MiniHipatterns-examples| for common configuration examples.
|
|
16
|
+
|
|
17
|
+
Notes:
|
|
18
|
+
- It does not define any highlighters by default. Add to `config.highlighters`
|
|
19
|
+
to have a visible effect.
|
|
20
|
+
|
|
21
|
+
- Sometimes (especially during frequent buffer updates on same line numbers)
|
|
22
|
+
highlighting can be outdated or not applied when it should be. This is due
|
|
23
|
+
to asynchronous nature of updates reacting to text changes (via
|
|
24
|
+
`on_lines` of |nvim_buf_attach()|).
|
|
25
|
+
To make them up to date, use one of the following:
|
|
26
|
+
- Scroll window (for example, with |CTRL-E| / |CTRL-Y|). This will ensure
|
|
27
|
+
up to date highlighting inside window view.
|
|
28
|
+
- Hide and show buffer.
|
|
29
|
+
- Execute `:edit` (if you enabled highlighting with |MiniHipatterns.setup()|).
|
|
30
|
+
- Manually call |MiniHipatterns.update()|.
|
|
31
|
+
|
|
32
|
+
- If you experience flicker when typing near highlighted pattern in Insert
|
|
33
|
+
mode, it might be due to `delay` configuration of |mini.completion| or
|
|
34
|
+
using built-in completion.
|
|
35
|
+
For better experience with |mini.completion|, make sure that its
|
|
36
|
+
`delay.completion` is less than this module's `delay.text_change` (which
|
|
37
|
+
it is by default).
|
|
38
|
+
The reason for this is (currently unresolvable) limitations of Neovim's
|
|
39
|
+
built-in completion implementation.
|
|
40
|
+
|
|
41
|
+
# Setup ~
|
|
42
|
+
|
|
43
|
+
Setting up highlights can be done in two ways:
|
|
44
|
+
- Manually for every buffer with `require('mini.hipatterns').enable()`.
|
|
45
|
+
This will enable highlighting only in one particular buffer until it is
|
|
46
|
+
unloaded (which also includes calling `:edit` on current file).
|
|
47
|
+
|
|
48
|
+
- Globally with `require('mini.hipatterns').setup({})` (replace `{}` with
|
|
49
|
+
your `config` table). This will auto-enable highlighting in "normal"
|
|
50
|
+
buffers (see |'buftype'|). Use |MiniHipatterns.enable()| to manually enable
|
|
51
|
+
in other buffers.
|
|
52
|
+
It will also create global Lua table `MiniHipatterns` which you can use
|
|
53
|
+
for scripting or manually (with `:lua MiniHipatterns.*`).
|
|
54
|
+
|
|
55
|
+
See |MiniHipatterns.config| for `config` structure and default values.
|
|
56
|
+
|
|
57
|
+
You can override runtime config settings (like highlighters and delays)
|
|
58
|
+
locally to buffer inside `vim.b.minihipatterns_config` which should have
|
|
59
|
+
same structure as `MiniHipatterns.config`.
|
|
60
|
+
See |mini.nvim-buffer-local-config| for more details.
|
|
61
|
+
|
|
62
|
+
# Comparisons ~
|
|
63
|
+
|
|
64
|
+
- [folke/todo-comments](https://github.com/folke/todo-comments):
|
|
65
|
+
- Oriented for "TODO", "NOTE", "FIXME" like patterns, while this module
|
|
66
|
+
can work with any Lua patterns and computable highlight groups.
|
|
67
|
+
- Has functionality beyond text highlighting (sign placing,
|
|
68
|
+
"telescope.nvim" extension, etc.), while this module only focuses on
|
|
69
|
+
highlighting text.
|
|
70
|
+
- [folke/paint.nvim](https://github.com/folke/paint.nvim):
|
|
71
|
+
- Mostly similar to this module, but with slightly less functionality,
|
|
72
|
+
such as computed pattern and highlight group, asynchronous delay, etc.
|
|
73
|
+
- [NvChad/nvim-colorizer.lua](https://github.com/NvChad/nvim-colorizer.lua):
|
|
74
|
+
- Oriented for color highlighting, while this module can work with any
|
|
75
|
+
Lua patterns and computable highlight groups.
|
|
76
|
+
- Has more built-in color spaces to highlight, while this module out of
|
|
77
|
+
the box provides only hex color highlighting
|
|
78
|
+
(see |MiniHipatterns.gen_highlighter.hex_color()|). Other types are
|
|
79
|
+
also possible to implement.
|
|
80
|
+
- [uga-rosa/ccc.nvim](https://github.com/uga-rosa/ccc.nvim):
|
|
81
|
+
- Has more than color highlighting functionality, which is compared to
|
|
82
|
+
this module in the same way as `NvChad/nvim-colorizer.lua`.
|
|
83
|
+
|
|
84
|
+
# Highlight groups ~
|
|
85
|
+
*MiniHipatterns-hl-groups*
|
|
86
|
+
|
|
87
|
+
- `MiniHipatternsFixme` - suggested group to use for `FIXME`-like patterns.
|
|
88
|
+
- `MiniHipatternsHack` - suggested group to use for `HACK`-like patterns.
|
|
89
|
+
- `MiniHipatternsTodo` - suggested group to use for `TODO`-like patterns.
|
|
90
|
+
- `MiniHipatternsNote` - suggested group to use for `NOTE`-like patterns.
|
|
91
|
+
|
|
92
|
+
To change any highlight group, set it directly with |nvim_set_hl()|.
|
|
93
|
+
|
|
94
|
+
# Disabling ~
|
|
95
|
+
|
|
96
|
+
This module can be disabled in three ways:
|
|
97
|
+
- Globally: set `vim.g.minihipatterns_disable` to `true`.
|
|
98
|
+
- Locally for buffer permanently: set `vim.b.minihipatterns_disable` to `true`.
|
|
99
|
+
- Locally for buffer temporarily (until next auto-enabling event if set up
|
|
100
|
+
with |MiniHipatterns.setup()|): call |MiniHipatterns.disable()|.
|
|
101
|
+
|
|
102
|
+
Considering high number of different scenarios and customization
|
|
103
|
+
intentions, writing exact rules for disabling module's functionality is
|
|
104
|
+
left to user. See |mini.nvim-disabling-recipes| for common recipes.
|
|
105
|
+
|
|
106
|
+
------------------------------------------------------------------------------
|
|
107
|
+
*MiniHipatterns-examples*
|
|
108
|
+
# Common configuration examples ~
|
|
109
|
+
|
|
110
|
+
- Special words used to convey different level of attention: >lua
|
|
111
|
+
|
|
112
|
+
require('mini.hipatterns').setup({
|
|
113
|
+
highlighters = {
|
|
114
|
+
fixme = { pattern = 'FIXME', group = 'MiniHipatternsFixme' },
|
|
115
|
+
hack = { pattern = 'HACK', group = 'MiniHipatternsHack' },
|
|
116
|
+
todo = { pattern = 'TODO', group = 'MiniHipatternsTodo' },
|
|
117
|
+
note = { pattern = 'NOTE', group = 'MiniHipatternsNote' },
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
<
|
|
121
|
+
- To match only when pattern appears as a standalone word, use frontier
|
|
122
|
+
patterns `%f`. For example, instead of `'TODO'` pattern use
|
|
123
|
+
`'%f[%w]()TODO()%f[%W]'`. In this case, for example, `TODOING` or `MYTODO`
|
|
124
|
+
won't match, but `TODO` and `TODO:` will.
|
|
125
|
+
|
|
126
|
+
- Color hex (like `#rrggbb`) highlighting: >lua
|
|
127
|
+
|
|
128
|
+
local hipatterns = require('mini.hipatterns')
|
|
129
|
+
hipatterns.setup({
|
|
130
|
+
highlighters = {
|
|
131
|
+
hex_color = hipatterns.gen_highlighter.hex_color(),
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
<
|
|
135
|
+
You can customize which part of hex color is highlighted by using `style`
|
|
136
|
+
field of input options. See |MiniHipatterns.gen_highlighter.hex_color()|.
|
|
137
|
+
|
|
138
|
+
- Colored words: >lua
|
|
139
|
+
|
|
140
|
+
local words = { red = '#ff0000', green = '#00ff00', blue = '#0000ff' }
|
|
141
|
+
local word_color_group = function(_, match)
|
|
142
|
+
local hex = words[match]
|
|
143
|
+
if hex == nil then return nil end
|
|
144
|
+
return MiniHipatterns.compute_hex_color_group(hex, 'bg')
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
local hipatterns = require('mini.hipatterns')
|
|
148
|
+
hipatterns.setup({
|
|
149
|
+
highlighters = {
|
|
150
|
+
word_color = { pattern = '%S+', group = word_color_group },
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
<
|
|
154
|
+
- Trailing whitespace (if don't want to use more specific |mini.trailspace|): >lua
|
|
155
|
+
|
|
156
|
+
{ pattern = '%f[%s]%s*$', group = 'Error' }
|
|
157
|
+
<
|
|
158
|
+
- Censor certain sensitive information: >lua
|
|
159
|
+
|
|
160
|
+
local censor_extmark_opts = function(_, match, _)
|
|
161
|
+
local mask = string.rep('x', vim.fn.strchars(match))
|
|
162
|
+
return {
|
|
163
|
+
virt_text = { { mask, 'Comment' } }, virt_text_pos = 'overlay',
|
|
164
|
+
priority = 200, right_gravity = false,
|
|
165
|
+
}
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
require('mini.hipatterns').setup({
|
|
169
|
+
highlighters = {
|
|
170
|
+
censor = {
|
|
171
|
+
pattern = 'password: ()%S+()',
|
|
172
|
+
group = '',
|
|
173
|
+
extmark_opts = censor_extmark_opts,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
})
|
|
177
|
+
<
|
|
178
|
+
- Enable only in certain filetypes. There are at least these ways to do it:
|
|
179
|
+
- (Suggested) With `vim.b.minihipatterns_config` in |filetype-plugin|.
|
|
180
|
+
Basically, create "after/ftplugin/<filetype>.lua" file in your config
|
|
181
|
+
directory (see |$XDG_CONFIG_HOME|) and define `vim.b.minihipatterns_config`
|
|
182
|
+
there with filetype specific highlighters.
|
|
183
|
+
|
|
184
|
+
This assumes `require('mini.hipatterns').setup()` call.
|
|
185
|
+
|
|
186
|
+
For example, to highlight keywords in EmmyLua comments in Lua files,
|
|
187
|
+
create "after/ftplugin/lua.lua" with the following content: >lua
|
|
188
|
+
|
|
189
|
+
vim.b.minihipatterns_config = {
|
|
190
|
+
highlighters = {
|
|
191
|
+
emmylua = { pattern = '^%s*%-%-%-()@%w+()', group = 'Special' }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
<
|
|
195
|
+
- Use callable `pattern` with condition. For example: >lua
|
|
196
|
+
|
|
197
|
+
require('mini.hipatterns').setup({
|
|
198
|
+
highlighters = {
|
|
199
|
+
emmylua = {
|
|
200
|
+
pattern = function(buf_id)
|
|
201
|
+
if vim.bo[buf_id].filetype ~= 'lua' then return nil end
|
|
202
|
+
return '^%s*%-%-%-()@%w+()'
|
|
203
|
+
end,
|
|
204
|
+
group = 'Special',
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
})
|
|
208
|
+
<
|
|
209
|
+
- Disable only in certain filetypes. Enable with |MiniHipatterns.setup()|
|
|
210
|
+
and set `vim.b.minihipatterns_disable` buffer-local variable to `true` for
|
|
211
|
+
buffer you want disabled. See |mini.nvim-disabling-recipes| for more examples.
|
|
212
|
+
|
|
213
|
+
------------------------------------------------------------------------------
|
|
214
|
+
*MiniHipatterns.setup()*
|
|
215
|
+
`MiniHipatterns.setup`({config})
|
|
216
|
+
Module setup
|
|
217
|
+
|
|
218
|
+
Parameters ~
|
|
219
|
+
{config} `(table|nil)` Module config table. See |MiniHipatterns.config|.
|
|
220
|
+
|
|
221
|
+
Usage ~
|
|
222
|
+
>lua
|
|
223
|
+
require('mini.hipatterns').setup({}) -- replace {} with your config table
|
|
224
|
+
-- needs `highlighters` field present
|
|
225
|
+
<
|
|
226
|
+
------------------------------------------------------------------------------
|
|
227
|
+
*MiniHipatterns.config*
|
|
228
|
+
`MiniHipatterns.config`
|
|
229
|
+
Defaults ~
|
|
230
|
+
>lua
|
|
231
|
+
MiniHipatterns.config = {
|
|
232
|
+
-- Table with highlighters (see |MiniHipatterns.config| for more details).
|
|
233
|
+
-- Nothing is defined by default. Add manually for visible effect.
|
|
234
|
+
highlighters = {},
|
|
235
|
+
|
|
236
|
+
-- Delays (in ms) defining asynchronous highlighting process
|
|
237
|
+
delay = {
|
|
238
|
+
-- How much to wait for update after every text change
|
|
239
|
+
text_change = 200,
|
|
240
|
+
|
|
241
|
+
-- How much to wait for update after window scroll
|
|
242
|
+
scroll = 50,
|
|
243
|
+
},
|
|
244
|
+
}
|
|
245
|
+
<
|
|
246
|
+
# Highlighters ~
|
|
247
|
+
|
|
248
|
+
`highlighters` table defines which patterns will be highlighted by placing
|
|
249
|
+
|extmark| at the match start. It might or might not have explicitly named
|
|
250
|
+
fields, but having them is recommended and is required for proper use of
|
|
251
|
+
`vim.b.minihipatterns_config` as buffer-local config. By default it is
|
|
252
|
+
empty expecting user definition.
|
|
253
|
+
|
|
254
|
+
Each entry defines single highlighter as a table with the following fields:
|
|
255
|
+
- <pattern> `(string|function|table)` - Lua pattern to highlight. Can be
|
|
256
|
+
either string, callable returning the string, or an array of those.
|
|
257
|
+
If string:
|
|
258
|
+
- It can have submatch delimited by placing `()` on start and end, NOT
|
|
259
|
+
by surrounding it with parenthesis (results in an error containing
|
|
260
|
+
`number expected, got string`). Example: `xx()abcd()xx` will match
|
|
261
|
+
`abcd` only if `xx` is placed before and after it.
|
|
262
|
+
|
|
263
|
+
If callable:
|
|
264
|
+
- It will be called for every enabled buffer with its identifier as input.
|
|
265
|
+
Should return single string pattern or `nil` (meaning this particular
|
|
266
|
+
highlighter will not work in this particular buffer).
|
|
267
|
+
|
|
268
|
+
If array:
|
|
269
|
+
- Each element is matched and highlighted with the same highlight group.
|
|
270
|
+
|
|
271
|
+
Note: matching does not result in overlapping (sub)matches (similarly
|
|
272
|
+
to how |cpo-c| works). For example, with line `xxxxxxx`:
|
|
273
|
+
- Pattern `xxx` matches columns 1-3, 4-6.
|
|
274
|
+
- Pattern `()xx()x` matches columns 1-2, 3-4, 5-6.
|
|
275
|
+
- Pattern `x()xx()` matches columns 2-3, 5-6.
|
|
276
|
+
- Pattern `x()x()x` matches columns 2-2, 4-4, 6-6.
|
|
277
|
+
|
|
278
|
+
- <group> `(string|function)` - name of highlight group to use. Can be either
|
|
279
|
+
string or callable returning the string.
|
|
280
|
+
If callable:
|
|
281
|
+
- It will be called for every pattern match with the following arguments:
|
|
282
|
+
- `buf_id` - buffer identifier.
|
|
283
|
+
- `match` - string pattern match to be highlighted.
|
|
284
|
+
- `data` - extra table with information about the match.
|
|
285
|
+
It has at least these fields:
|
|
286
|
+
- <full_match> - string with full pattern match.
|
|
287
|
+
- <line> - match line number (1-indexed).
|
|
288
|
+
- <from_col> - match starting byte column (1-indexed).
|
|
289
|
+
- <to_col> - match ending byte column (1-indexed, inclusive).
|
|
290
|
+
|
|
291
|
+
- It can return `nil` meaning this particular match will not be highlighted.
|
|
292
|
+
|
|
293
|
+
- <extmark_opts> `(table|function|nil)` - optional extra options
|
|
294
|
+
for |nvim_buf_set_extmark()|. If callable, will be called in the same way
|
|
295
|
+
as callable <group> (`data` will also contain `hl_group` key with <group>
|
|
296
|
+
value) and should return a table with all options for extmark (including
|
|
297
|
+
`end_row`, `end_col`, `hl_group`, and `priority`).
|
|
298
|
+
|
|
299
|
+
See "Common use cases" section for the examples.
|
|
300
|
+
|
|
301
|
+
# Delay ~
|
|
302
|
+
|
|
303
|
+
`delay` is a table defining delays in milliseconds used for asynchronous
|
|
304
|
+
highlighting process.
|
|
305
|
+
|
|
306
|
+
`delay.text_change` is used to delay highlighting updates by accumulating
|
|
307
|
+
them (in debounce fashion). Smaller values will lead to faster response but
|
|
308
|
+
more frequent updates. Bigger - slower response but less frequent updates.
|
|
309
|
+
|
|
310
|
+
`delay.scroll` is used to delay updating highlights in current window view
|
|
311
|
+
during scrolling (see |WinScrolled| event). These updates are present to
|
|
312
|
+
ensure up to date highlighting after scroll.
|
|
313
|
+
|
|
314
|
+
------------------------------------------------------------------------------
|
|
315
|
+
*MiniHipatterns.enable()*
|
|
316
|
+
`MiniHipatterns.enable`({buf_id}, {config})
|
|
317
|
+
Enable highlighting in buffer
|
|
318
|
+
|
|
319
|
+
Notes:
|
|
320
|
+
- With default config it will highlight nothing, as there are no default
|
|
321
|
+
highlighters.
|
|
322
|
+
|
|
323
|
+
- Buffer highlighting is enabled until buffer is unloaded from memory
|
|
324
|
+
or |MiniHipatterns.disable()| on this buffer is called.
|
|
325
|
+
|
|
326
|
+
- `:edit` disables this, as it is mostly equivalent to closing and opening
|
|
327
|
+
buffer. In order for highlighting to persist after `:edit`, call
|
|
328
|
+
|MiniHipatterns.setup()|.
|
|
329
|
+
|
|
330
|
+
Parameters ~
|
|
331
|
+
{buf_id} `(number|nil)` Buffer identifier in which to enable highlighting.
|
|
332
|
+
Default: 0 for current buffer.
|
|
333
|
+
{config} `(table|nil)` Optional buffer-local config. Should have the same
|
|
334
|
+
structure as |MiniHipatterns.config|. Values will be taken in this order:
|
|
335
|
+
- From this `config` argument (if supplied).
|
|
336
|
+
- From buffer-local config in `vim.b.minihipatterns_config` (if present).
|
|
337
|
+
- From global config (if |MiniHipatterns.setup()| was called).
|
|
338
|
+
- From default values.
|
|
339
|
+
|
|
340
|
+
------------------------------------------------------------------------------
|
|
341
|
+
*MiniHipatterns.disable()*
|
|
342
|
+
`MiniHipatterns.disable`({buf_id})
|
|
343
|
+
Disable highlighting in buffer
|
|
344
|
+
|
|
345
|
+
Note that if |MiniHipatterns.setup()| was called, the effect is present
|
|
346
|
+
until the next auto-enabling event. To permanently disable highlighting in
|
|
347
|
+
buffer, set `vim.b.minihipatterns_disable` to `true`
|
|
348
|
+
|
|
349
|
+
Parameters ~
|
|
350
|
+
{buf_id} `(number|nil)` Buffer identifier in which to enable highlighting.
|
|
351
|
+
Default: 0 for current buffer.
|
|
352
|
+
|
|
353
|
+
------------------------------------------------------------------------------
|
|
354
|
+
*MiniHipatterns.toggle()*
|
|
355
|
+
`MiniHipatterns.toggle`({buf_id}, {config})
|
|
356
|
+
Toggle highlighting in buffer
|
|
357
|
+
|
|
358
|
+
Call |MiniHipatterns.disable()| if enabled; |MiniHipatterns.enable()| otherwise.
|
|
359
|
+
|
|
360
|
+
Parameters ~
|
|
361
|
+
{buf_id} `(number|nil)` Buffer identifier in which to enable highlighting.
|
|
362
|
+
Default: 0 for current buffer.
|
|
363
|
+
{config} `(table|nil)` Forwarded to |MiniHipatterns.enable()|.
|
|
364
|
+
|
|
365
|
+
------------------------------------------------------------------------------
|
|
366
|
+
*MiniHipatterns.update()*
|
|
367
|
+
`MiniHipatterns.update`({buf_id}, {from_line}, {to_line})
|
|
368
|
+
Update highlighting in range
|
|
369
|
+
|
|
370
|
+
Works only in buffer with enabled highlighting. Effect takes immediately
|
|
371
|
+
without delay.
|
|
372
|
+
|
|
373
|
+
Parameters ~
|
|
374
|
+
{buf_id} `(number|nil)` Buffer identifier in which to enable highlighting.
|
|
375
|
+
Default: 0 for current buffer.
|
|
376
|
+
{from_line} `(number|nil)` Start line from which to update (1-indexed).
|
|
377
|
+
{to_line} `(number|nil)` End line from which to update (1-indexed, inclusive).
|
|
378
|
+
|
|
379
|
+
------------------------------------------------------------------------------
|
|
380
|
+
*MiniHipatterns.get_enabled_buffers()*
|
|
381
|
+
`MiniHipatterns.get_enabled_buffers`()
|
|
382
|
+
Get an array of enabled buffers
|
|
383
|
+
|
|
384
|
+
Return ~
|
|
385
|
+
`(table)` Array of buffer identifiers with enabled highlighting.
|
|
386
|
+
|
|
387
|
+
------------------------------------------------------------------------------
|
|
388
|
+
*MiniHipatterns.get_matches()*
|
|
389
|
+
`MiniHipatterns.get_matches`({buf_id}, {highlighters})
|
|
390
|
+
Get buffer matches
|
|
391
|
+
|
|
392
|
+
Parameters ~
|
|
393
|
+
{buf_id} `(number|nil)` Buffer identifier for which to return matches.
|
|
394
|
+
Default: `nil` for current buffer.
|
|
395
|
+
{highlighters} `(table|nil)` Array of highlighter identifiers (as in
|
|
396
|
+
`highlighters` field of |MiniHipatterns.config|) for which to return matches.
|
|
397
|
+
Default: all available highlighters (ordered by string representation).
|
|
398
|
+
|
|
399
|
+
Return ~
|
|
400
|
+
`(table)` Array of buffer matches which are tables with following fields:
|
|
401
|
+
- <bufnr> `(number)` - buffer identifier of a match.
|
|
402
|
+
- <highlighter> `(any)` - highlighter identifier which produced the match.
|
|
403
|
+
- <lnum> `(number)` - line number of the match start (starts with 1).
|
|
404
|
+
- <col> `(number)` - column number of the match start (starts with 1).
|
|
405
|
+
- <end_lnum> `(number|nil)` - line number of the match end (starts with 1).
|
|
406
|
+
- <end_col> `(number|nil)` - column number next to the match end
|
|
407
|
+
(implements end-exclusive region; starts with 1).
|
|
408
|
+
- <hl_group> `(string|nil)` - name of match's highlight group.
|
|
409
|
+
|
|
410
|
+
Matches are ordered first by supplied `highlighters`, then by line and
|
|
411
|
+
column of match start.
|
|
412
|
+
|
|
413
|
+
------------------------------------------------------------------------------
|
|
414
|
+
*MiniHipatterns.gen_highlighter*
|
|
415
|
+
`MiniHipatterns.gen_highlighter`
|
|
416
|
+
Generate builtin highlighters
|
|
417
|
+
|
|
418
|
+
This is a table with function elements. Call to actually get highlighter.
|
|
419
|
+
|
|
420
|
+
------------------------------------------------------------------------------
|
|
421
|
+
*MiniHipatterns.gen_highlighter.hex_color()*
|
|
422
|
+
`MiniHipatterns.gen_highlighter.hex_color`({opts})
|
|
423
|
+
Highlight hex color string
|
|
424
|
+
|
|
425
|
+
This will match color hex string in format `#rrggbb` and highlight it
|
|
426
|
+
according to `opts.style` displaying matched color.
|
|
427
|
+
|
|
428
|
+
Highlight group is computed using |MiniHipatterns.compute_hex_color_group()|,
|
|
429
|
+
so all its usage notes apply here.
|
|
430
|
+
|
|
431
|
+
Parameters ~
|
|
432
|
+
{opts} `(table|nil)` Options. Possible fields:
|
|
433
|
+
- <style> `(string)` - one of:
|
|
434
|
+
- `'full'` - highlight background of whole hex string with it. Default.
|
|
435
|
+
- `'#'` - highlight background of only `#`.
|
|
436
|
+
- `'line'` - highlight underline with that color.
|
|
437
|
+
- `'inline'` - highlight text of <inline_text>.
|
|
438
|
+
Note: requires Neovim>=0.10.
|
|
439
|
+
- <priority> `(number)` - priority of highlighting. Default: 200.
|
|
440
|
+
- <filter> `(function)` - callable object used to filter buffers in which
|
|
441
|
+
highlighting will take place. It should take buffer identifier as input
|
|
442
|
+
and return `false` or `nil` to not highlight inside this buffer.
|
|
443
|
+
- <inline_text> `(string)` - string to be placed and highlighted with color
|
|
444
|
+
to the right of match in case <style> is "inline". Default: "█".
|
|
445
|
+
- <max_number> `(number)` - as in |MiniHipatterns.compute_hex_color_group()|.
|
|
446
|
+
|
|
447
|
+
Return ~
|
|
448
|
+
`(table)` Highlighter table ready to be used as part of `config.highlighters`.
|
|
449
|
+
Both `pattern` and `group` are callable.
|
|
450
|
+
|
|
451
|
+
Usage ~
|
|
452
|
+
>lua
|
|
453
|
+
local hipatterns = require('mini.hipatterns')
|
|
454
|
+
hipatterns.setup({
|
|
455
|
+
highlighters = {
|
|
456
|
+
hex_color = hipatterns.gen_highlighter.hex_color(),
|
|
457
|
+
}
|
|
458
|
+
})
|
|
459
|
+
<
|
|
460
|
+
------------------------------------------------------------------------------
|
|
461
|
+
*MiniHipatterns.compute_hex_color_group()*
|
|
462
|
+
`MiniHipatterns.compute_hex_color_group`({hex_color}, {style}, {opts})
|
|
463
|
+
Compute and create group to highlight hex color string
|
|
464
|
+
|
|
465
|
+
Notes:
|
|
466
|
+
- This works properly only with enabled |'termguicolors'|.
|
|
467
|
+
|
|
468
|
+
- To increase performance, it caches highlight groups per `hex_color` and
|
|
469
|
+
`style` combination. Needs a call to |MiniHipatterns.setup()| to have
|
|
470
|
+
these groups be persistent across color scheme changes.
|
|
471
|
+
|
|
472
|
+
Parameters ~
|
|
473
|
+
{hex_color} `(string)` Hex color string in format `#rrggbb`.
|
|
474
|
+
{style|nil} `(string)` One of:
|
|
475
|
+
- `'bg'` - highlight background with `hex_color` and foreground with black or
|
|
476
|
+
white (whichever is more visible). Default.
|
|
477
|
+
- `'fg'` - highlight foreground with `hex_color`.
|
|
478
|
+
- `'line'` - highlight underline with `hex_color`.
|
|
479
|
+
{opts} `(table|nil)` Options. Possible fields:
|
|
480
|
+
- <max_number> `(number)` - maximum number of different highlight groups
|
|
481
|
+
this function is allowed to create. Useful to avoid |E849|.
|
|
482
|
+
Default: 10000.
|
|
483
|
+
|
|
484
|
+
Return ~
|
|
485
|
+
`(string|nil)` Name of created highlight group appropriate to show `hex_color`
|
|
486
|
+
or `nil` if highlighted groups was not created.
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
vim:tw=78:ts=8:noet:ft=help:norl:
|