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,477 @@
|
|
|
1
|
+
*mini.completion* Completion and signature help
|
|
2
|
+
|
|
3
|
+
MIT License Copyright (c) 2021 Evgeni Chasnovski
|
|
4
|
+
|
|
5
|
+
------------------------------------------------------------------------------
|
|
6
|
+
*MiniCompletion*
|
|
7
|
+
Key design ideas:
|
|
8
|
+
- Have an async (with customizable "debounce" delay) "two-stage chain
|
|
9
|
+
completion": first try to get completion items from LSP client (if set
|
|
10
|
+
up) and if no result, fallback to custom action.
|
|
11
|
+
|
|
12
|
+
- Managing completion is done as much with Neovim's built-in tools as
|
|
13
|
+
possible. |popupmenu-completion| is used to show completion suggestions.
|
|
14
|
+
|
|
15
|
+
Features:
|
|
16
|
+
- Two-stage chain completion:
|
|
17
|
+
- First stage is an LSP completion implemented via
|
|
18
|
+
|MiniCompletion.completefunc_lsp()|. It should be set up as either
|
|
19
|
+
|'completefunc'| or |'omnifunc'|. It tries to get completion items from
|
|
20
|
+
LSP client (via `textDocument/completion` request). Custom
|
|
21
|
+
preprocessing of response items is possible (with
|
|
22
|
+
`MiniCompletion.config.lsp_completion.process_items`), for example
|
|
23
|
+
with fuzzy matching. By default items directly starting with completed
|
|
24
|
+
word are kept and are sorted according to LSP specification.
|
|
25
|
+
Supports `additionalTextEdits`, like auto-import and others (see `# Notes`),
|
|
26
|
+
and snippet items (best results require |mini.snippets| dependency).
|
|
27
|
+
- If first stage is not set up or resulted into no candidates, fallback
|
|
28
|
+
action is executed. The most tested actions are Neovim's built-in
|
|
29
|
+
insert completion (see |ins-completion|).
|
|
30
|
+
|
|
31
|
+
- Automatic display in floating window of completion item info (via
|
|
32
|
+
`completionItem/resolve` request) and signature help (with highlighting
|
|
33
|
+
of active parameter if LSP server provides such information).
|
|
34
|
+
Signature help is shown if character to cursor's left is a dedicated trigger
|
|
35
|
+
character (configured in `signatureHelpProvider.triggerCharacters` of LSP
|
|
36
|
+
server capabilities) and updated without delay if is currently opened.
|
|
37
|
+
Already shown window for signature help is fixed and is closed when there
|
|
38
|
+
is nothing to show, its text is different, or when leaving Insert mode.
|
|
39
|
+
Scroll in either info/signature window with `<C-f>` / `<C-b>` (by default).
|
|
40
|
+
|
|
41
|
+
- Automatic actions are done after some configurable amount of delay. This
|
|
42
|
+
reduces computational load and allows fast typing (completion and
|
|
43
|
+
signature help) and item selection (item info)
|
|
44
|
+
|
|
45
|
+
- Force two-stage/fallback completion (`<C-Space>` / `<A-Space>` by default).
|
|
46
|
+
|
|
47
|
+
- Customizable highlighting of LSP items. Requires Neovim>=0.11.
|
|
48
|
+
Use `config.lsp_completion.process_items` to set dedicated highlight group
|
|
49
|
+
in supported fields:
|
|
50
|
+
- <abbr_hlgroup> - item label (`abbr` in terms of |complete-items|).
|
|
51
|
+
By default only checks if item is marked as deprecated and sets
|
|
52
|
+
`MiniCompletionDeprecated` highlight group.
|
|
53
|
+
- <kind_hlgroup> - LSP kind ("Function", "Keyword", etc.). By default
|
|
54
|
+
uses "lsp" category of |mini.icons| (if enabled).
|
|
55
|
+
|
|
56
|
+
What it doesn't do:
|
|
57
|
+
- Many configurable sources.
|
|
58
|
+
- Automatic mapping of `<CR>`, `<Tab>`, etc. Those tend to have highly
|
|
59
|
+
variable user expectations. See `# Helpful mappings` for suggestions or
|
|
60
|
+
use |MiniKeymap.map_multistep()| with `"pmenu_*"` built-in steps.
|
|
61
|
+
|
|
62
|
+
# Dependencies ~
|
|
63
|
+
|
|
64
|
+
Suggested dependencies (provide extra functionality, will work without them):
|
|
65
|
+
|
|
66
|
+
- Enabled |mini.icons| module to highlight LSP kind (requires Neovim>=0.11).
|
|
67
|
+
If absent, |MiniCompletion.default_process_items()| does not add highlighting.
|
|
68
|
+
Also take a look at |MiniIcons.tweak_lsp_kind()|.
|
|
69
|
+
- Enabled |mini.snippets| module for better snippet handling (much recommended).
|
|
70
|
+
If absent and custom snippet insert is not configured, |vim.snippet.expand()|
|
|
71
|
+
is used on Neovim>=0.10 (nothing extra is done on earlier versions).
|
|
72
|
+
See |MiniCompletion.default_snippet_insert()|.
|
|
73
|
+
|
|
74
|
+
# Setup ~
|
|
75
|
+
|
|
76
|
+
This module needs a setup with `require('mini.completion').setup({})`
|
|
77
|
+
(replace `{}` with your `config` table). It will create global Lua table
|
|
78
|
+
`MiniCompletion` which you can use for scripting or manually (with
|
|
79
|
+
`:lua MiniCompletion.*`).
|
|
80
|
+
|
|
81
|
+
See |MiniCompletion.config| for `config` structure and default values.
|
|
82
|
+
|
|
83
|
+
You can override runtime config settings locally to buffer inside
|
|
84
|
+
`vim.b.minicompletion_config` which should have same structure as
|
|
85
|
+
`MiniCompletion.config`. See |mini.nvim-buffer-local-config| for more details.
|
|
86
|
+
|
|
87
|
+
# Suggested option values ~
|
|
88
|
+
|
|
89
|
+
Some options are set automatically (if not set before |MiniCompletion.setup()|):
|
|
90
|
+
- |'completeopt'| is set to "menuone,noselect" for less intrusive popup.
|
|
91
|
+
To enable fuzzy matching, manually set to "menuone,noselect,fuzzy". Consider
|
|
92
|
+
also adding "nosort" flag to preserve initial order when filtering.
|
|
93
|
+
- |'shortmess'| is appended with "c" flag for silent <C-n> fallback.
|
|
94
|
+
- |'complete'| gets removed "t" flag (if fallback action is default), as it
|
|
95
|
+
leads to visible lags.
|
|
96
|
+
|
|
97
|
+
# Snippets ~
|
|
98
|
+
|
|
99
|
+
As per LSP specification, some completion items can be supplied in the form of
|
|
100
|
+
snippet - a template with both pre-defined text and places (called "tabstops")
|
|
101
|
+
for user to interactively change/add text during snippet session.
|
|
102
|
+
|
|
103
|
+
In |mini.completion| items that will insert snippet have "S" symbol shown in
|
|
104
|
+
the popup (as part of `menu` in |complete-items|). To actually insert a snippet:
|
|
105
|
+
- Select an item via <C-n> / <C-p>. This will insert item's label (usually not
|
|
106
|
+
full snippet) first to reduce visual flicker. The full snippet text will be
|
|
107
|
+
shown in info window if LSP server doesn't provide its own info for an item.
|
|
108
|
+
- Press <C-y> (|complete_CTRL-Y|) or attempt inserting a non-keyword character
|
|
109
|
+
(like <CR>; new character will be removed). It will clear text from previous
|
|
110
|
+
step, set cursor, and call `lsp_completion.snippet_insert` with snippet text.
|
|
111
|
+
- Press <C-e> (|complete_CTRL-E|) to cancel snippet insert and properly end
|
|
112
|
+
completion.
|
|
113
|
+
|
|
114
|
+
See |MiniCompletion.default_snippet_insert()| for overview of how to work with
|
|
115
|
+
inserted snippets.
|
|
116
|
+
|
|
117
|
+
Notes:
|
|
118
|
+
- To stop LSP server from suggesting snippets, disable (set to `false`) the
|
|
119
|
+
following capability during LSP server start:
|
|
120
|
+
`textDocument.completion.completionItem.snippetSupport`.
|
|
121
|
+
- If snippet body doesn't contain tabstop, variable, tab, or newline,
|
|
122
|
+
`lsp_completion.snippet_insert` is not called and text is inserted as-is.
|
|
123
|
+
|
|
124
|
+
# Notes ~
|
|
125
|
+
|
|
126
|
+
- A more appropriate (albeit slightly advanced) LSP completion setup is to set
|
|
127
|
+
it not on every |BufEnter| event (default), but on every attach of LSP client.
|
|
128
|
+
To do that:
|
|
129
|
+
- Use in |MiniCompletion.setup()| config: >lua
|
|
130
|
+
|
|
131
|
+
lsp_completion = { source_func = 'omnifunc', auto_setup = false }
|
|
132
|
+
<
|
|
133
|
+
- Set |'omnifunc'| option to exactly `v:lua.MiniCompletion.completefunc_lsp`
|
|
134
|
+
for every client attach in an |LspAttach| event. Like this: >lua
|
|
135
|
+
|
|
136
|
+
local on_attach = function(args)
|
|
137
|
+
vim.bo[args.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
|
|
138
|
+
end
|
|
139
|
+
vim.api.nvim_create_autocmd('LspAttach', { callback = on_attach })
|
|
140
|
+
<
|
|
141
|
+
This setup is not default to allow simultaneous usage of filetype-specific
|
|
142
|
+
|'omnifunc'| (with manual |i_CTRL-X_CTRL-O|) and automated LSP completion.
|
|
143
|
+
|
|
144
|
+
- Use |MiniCompletion.get_lsp_capabilities()| to get/set information about part
|
|
145
|
+
of LSP specification supported by module. See its help for usability notes.
|
|
146
|
+
|
|
147
|
+
- Uses `vim.lsp.protocol.CompletionItemKind` map in LSP step to show a readable
|
|
148
|
+
version of item's kind. Modify it directly to change what is displayed.
|
|
149
|
+
If you have |mini.icons| enabled, take a look at |MiniIcons.tweak_lsp_kind()|.
|
|
150
|
+
|
|
151
|
+
- If you have trouble using custom (overridden) |vim.ui.input()|, disable
|
|
152
|
+
|mini.completion| for input buffer (usually based on its |'filetype'|).
|
|
153
|
+
|
|
154
|
+
# Comparisons ~
|
|
155
|
+
|
|
156
|
+
- [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp):
|
|
157
|
+
- Implements own popup menu to show completion candidates, while this
|
|
158
|
+
module reuses |ins-completion-menu|.
|
|
159
|
+
- Has more complex design which allows multiple sources, each in a form of
|
|
160
|
+
a separate plugin. This module has two built-in: LSP and fallback.
|
|
161
|
+
- Requires separate plugin for automated signature help.
|
|
162
|
+
- Implements own "ghost text" feature, while this module does not.
|
|
163
|
+
|
|
164
|
+
- [Saghen/blink.cmp](https://github.com/Saghen/blink.cmp):
|
|
165
|
+
- Mostly similar to `nvim-cmp` comparison: provides more features at the
|
|
166
|
+
cost of more code and config complexity, while this module is designed
|
|
167
|
+
to provide only a handful of "enough" features while relying on Neovim's
|
|
168
|
+
built-in capabilities as much as possible.
|
|
169
|
+
- Both provide automated signature help out of the box.
|
|
170
|
+
|
|
171
|
+
# Helpful mappings ~
|
|
172
|
+
|
|
173
|
+
If there is |mini.keymap| available, prefer using |MiniKeymap.map_multistep()|
|
|
174
|
+
with `"pmenu_*"` built-in steps. See |MiniKeymap-examples| for examples.
|
|
175
|
+
|
|
176
|
+
To use `<Tab>` and `<S-Tab>` for navigation through completion list, make
|
|
177
|
+
these mappings: >lua
|
|
178
|
+
|
|
179
|
+
local imap_expr = function(lhs, rhs)
|
|
180
|
+
vim.keymap.set('i', lhs, rhs, { expr = true })
|
|
181
|
+
end
|
|
182
|
+
imap_expr('<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]])
|
|
183
|
+
imap_expr('<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]])
|
|
184
|
+
<
|
|
185
|
+
To get more consistent behavior of `<CR>`, you can use this template in
|
|
186
|
+
your `init.lua` to make customized mapping: >lua
|
|
187
|
+
|
|
188
|
+
_G.cr_action = function()
|
|
189
|
+
-- If there is selected item in popup, accept it with <C-y>
|
|
190
|
+
if vim.fn.complete_info()['selected'] ~= -1 then return '\25' end
|
|
191
|
+
-- Fall back to plain `<CR>`. You might want to customize according
|
|
192
|
+
-- to other plugins. For example if 'mini.pairs' is set up, replace
|
|
193
|
+
-- next line with `return MiniPairs.cr()`
|
|
194
|
+
return '\r'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
vim.keymap.set('i', '<CR>', 'v:lua.cr_action()', { expr = true })
|
|
198
|
+
<
|
|
199
|
+
# Highlight groups ~
|
|
200
|
+
*MiniCompletion-hl-groups*
|
|
201
|
+
|
|
202
|
+
- `MiniCompletionActiveParameter` - signature active parameter.
|
|
203
|
+
- `MiniCompletionDeprecated` - candidates that marked as deprecated.
|
|
204
|
+
- `MiniCompletionInfoBorderOutdated` - info window border when text is outdated
|
|
205
|
+
due to explicit delay during fast movement through candidates.
|
|
206
|
+
|
|
207
|
+
To change any highlight group, set it directly with |nvim_set_hl()|.
|
|
208
|
+
|
|
209
|
+
# Disabling ~
|
|
210
|
+
|
|
211
|
+
To disable, set `vim.g.minicompletion_disable` (globally) or
|
|
212
|
+
`vim.b.minicompletion_disable` (for a buffer) to `true`. Considering high
|
|
213
|
+
number of different scenarios and customization intentions, writing exact
|
|
214
|
+
rules for disabling module's functionality is left to user. See
|
|
215
|
+
|mini.nvim-disabling-recipes| for common recipes.
|
|
216
|
+
|
|
217
|
+
------------------------------------------------------------------------------
|
|
218
|
+
*MiniCompletion-events*
|
|
219
|
+
To allow user customization, certain |User| autocommand events are
|
|
220
|
+
triggered under common circumstances:
|
|
221
|
+
|
|
222
|
+
- Info and signature help window:
|
|
223
|
+
- `MiniCompletionWindowOpen` - after opening new window.
|
|
224
|
+
- `MiniCompletionWindowUpdate` - after updating existing window.
|
|
225
|
+
|
|
226
|
+
Each event's |event-data| table contains `kind` (one of "info" or "signature")
|
|
227
|
+
and `win_id` (affected window identifier) fields.
|
|
228
|
+
|
|
229
|
+
------------------------------------------------------------------------------
|
|
230
|
+
*MiniCompletion.setup()*
|
|
231
|
+
`MiniCompletion.setup`({config})
|
|
232
|
+
Module setup
|
|
233
|
+
|
|
234
|
+
Parameters ~
|
|
235
|
+
{config} `(table|nil)` Module config table. See |MiniCompletion.config|.
|
|
236
|
+
|
|
237
|
+
Usage ~
|
|
238
|
+
>lua
|
|
239
|
+
require('mini.completion').setup() -- use default config
|
|
240
|
+
-- OR
|
|
241
|
+
require('mini.completion').setup({}) -- replace {} with your config table
|
|
242
|
+
<
|
|
243
|
+
------------------------------------------------------------------------------
|
|
244
|
+
*MiniCompletion.config*
|
|
245
|
+
`MiniCompletion.config`
|
|
246
|
+
Defaults ~
|
|
247
|
+
>lua
|
|
248
|
+
MiniCompletion.config = {
|
|
249
|
+
-- Delay (debounce type, in ms) between certain Neovim event and action.
|
|
250
|
+
-- This can be used to (virtually) disable certain automatic actions by
|
|
251
|
+
-- setting very high delay time (like 10^7).
|
|
252
|
+
delay = { completion = 100, info = 100, signature = 50 },
|
|
253
|
+
|
|
254
|
+
-- Configuration for action windows:
|
|
255
|
+
-- - `height` and `width` are maximum dimensions.
|
|
256
|
+
-- - `border` defines border (as in `nvim_open_win()`; default "single").
|
|
257
|
+
window = {
|
|
258
|
+
info = { height = 25, width = 80, border = nil },
|
|
259
|
+
signature = { height = 25, width = 80, border = nil },
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
-- Way of how module does LSP completion
|
|
263
|
+
lsp_completion = {
|
|
264
|
+
-- `source_func` should be one of 'completefunc' or 'omnifunc'.
|
|
265
|
+
source_func = 'completefunc',
|
|
266
|
+
|
|
267
|
+
-- `auto_setup` should be boolean indicating if LSP completion is set up
|
|
268
|
+
-- on every `BufEnter` event.
|
|
269
|
+
auto_setup = true,
|
|
270
|
+
|
|
271
|
+
-- A function which takes LSP 'textDocument/completion' response items
|
|
272
|
+
-- (each with `client_id` field for item's server) and word to complete.
|
|
273
|
+
-- Output should be a table of the same nature as input. Common use case
|
|
274
|
+
-- is custom filter/sort. Default: `default_process_items`
|
|
275
|
+
process_items = nil,
|
|
276
|
+
|
|
277
|
+
-- A function which takes a snippet as string and inserts it at cursor.
|
|
278
|
+
-- Default: `default_snippet_insert` which tries to use 'mini.snippets'
|
|
279
|
+
-- and falls back to `vim.snippet.expand` (on Neovim>=0.10).
|
|
280
|
+
snippet_insert = nil,
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
-- Fallback action as function/string. Executed in Insert mode.
|
|
284
|
+
-- To use built-in completion (`:h ins-completion`), set its mapping as
|
|
285
|
+
-- string. Example: set '<C-x><C-l>' for 'whole lines' completion.
|
|
286
|
+
fallback_action = '<C-n>',
|
|
287
|
+
|
|
288
|
+
-- Module mappings. Use `''` (empty string) to disable one. Some of them
|
|
289
|
+
-- might conflict with system mappings.
|
|
290
|
+
mappings = {
|
|
291
|
+
-- Force two-step/fallback completions
|
|
292
|
+
force_twostep = '<C-Space>',
|
|
293
|
+
force_fallback = '<A-Space>',
|
|
294
|
+
|
|
295
|
+
-- Scroll info/signature window down/up. When overriding, check for
|
|
296
|
+
-- conflicts with built-in keys for popup menu (like `<C-u>`/`<C-o>`
|
|
297
|
+
-- for 'completefunc'/'omnifunc' source function; or `<C-n>`/`<C-p>`).
|
|
298
|
+
scroll_down = '<C-f>',
|
|
299
|
+
scroll_up = '<C-b>',
|
|
300
|
+
},
|
|
301
|
+
}
|
|
302
|
+
<
|
|
303
|
+
------------------------------------------------------------------------------
|
|
304
|
+
*MiniCompletion.complete_twostage()*
|
|
305
|
+
`MiniCompletion.complete_twostage`({fallback}, {force})
|
|
306
|
+
Run two-stage completion
|
|
307
|
+
|
|
308
|
+
Parameters ~
|
|
309
|
+
{fallback} `(boolean|nil)` Whether to use fallback completion. Default: `true`.
|
|
310
|
+
{force} `(boolean|nil)` Whether to force update of completion popup.
|
|
311
|
+
Default: `true`.
|
|
312
|
+
|
|
313
|
+
------------------------------------------------------------------------------
|
|
314
|
+
*MiniCompletion.complete_fallback()*
|
|
315
|
+
`MiniCompletion.complete_fallback`()
|
|
316
|
+
Run fallback completion
|
|
317
|
+
|
|
318
|
+
------------------------------------------------------------------------------
|
|
319
|
+
*MiniCompletion.scroll()*
|
|
320
|
+
`MiniCompletion.scroll`({direction})
|
|
321
|
+
Scroll in info/signature window
|
|
322
|
+
|
|
323
|
+
Designed to be used in |:map-<expr>|.
|
|
324
|
+
Scrolling is done as if |CTRL-F| and |CTRL-B| is pressed inside target window.
|
|
325
|
+
Used in default `config.mappings.scroll_xxx` mappings.
|
|
326
|
+
|
|
327
|
+
Parameters ~
|
|
328
|
+
{direction} `(string)` One of `"down"` or `"up"`.
|
|
329
|
+
|
|
330
|
+
Return ~
|
|
331
|
+
`(boolean)` Whether scroll is scheduled to be done.
|
|
332
|
+
|
|
333
|
+
------------------------------------------------------------------------------
|
|
334
|
+
*MiniCompletion.stop()*
|
|
335
|
+
`MiniCompletion.stop`({actions})
|
|
336
|
+
Stop actions
|
|
337
|
+
|
|
338
|
+
This stops currently active (because of module delay or LSP answer delay)
|
|
339
|
+
actions.
|
|
340
|
+
|
|
341
|
+
Designed to be used with |autocmd|. No need to use it directly, everything
|
|
342
|
+
is setup in |MiniCompletion.setup()|.
|
|
343
|
+
|
|
344
|
+
Parameters ~
|
|
345
|
+
{actions} `(table|nil)` Array containing any of `'completion'`, `'info'`, or
|
|
346
|
+
`'signature'` strings. Default: array containing all of them.
|
|
347
|
+
|
|
348
|
+
------------------------------------------------------------------------------
|
|
349
|
+
*MiniCompletion.completefunc_lsp()*
|
|
350
|
+
`MiniCompletion.completefunc_lsp`({findstart}, {base})
|
|
351
|
+
Module's |complete-functions|
|
|
352
|
+
|
|
353
|
+
This is the main function which enables two-stage completion. It should be
|
|
354
|
+
set as one of |'completefunc'| or |'omnifunc'|.
|
|
355
|
+
|
|
356
|
+
No need to use it directly, everything is setup in |MiniCompletion.setup()|.
|
|
357
|
+
|
|
358
|
+
------------------------------------------------------------------------------
|
|
359
|
+
*MiniCompletion.default_process_items()*
|
|
360
|
+
`MiniCompletion.default_process_items`({items}, {base}, {opts})
|
|
361
|
+
Default processing of LSP items
|
|
362
|
+
|
|
363
|
+
Steps:
|
|
364
|
+
- Filter and sort items according to supplied method.
|
|
365
|
+
- Arrange items further by completion item kind according to their priority.
|
|
366
|
+
- Add `MiniCompletionDeprecated` <abbr_hlgroup> if item is marked as deprecated.
|
|
367
|
+
- If |mini.icons| is enabled, add <kind_hlgroup> based on the "lsp" category.
|
|
368
|
+
|
|
369
|
+
Example of forcing fuzzy matching, filtering out `Text` items, and putting
|
|
370
|
+
`Snippet` items last: >lua
|
|
371
|
+
|
|
372
|
+
local kind_priority = { Text = -1, Snippet = 99 }
|
|
373
|
+
local opts = { filtersort = 'fuzzy', kind_priority = kind_priority }
|
|
374
|
+
local process_items = function(items, base)
|
|
375
|
+
return MiniCompletion.default_process_items(items, base, opts)
|
|
376
|
+
end
|
|
377
|
+
require('mini.completion').setup({
|
|
378
|
+
lsp_completion = { process_items = process_items },
|
|
379
|
+
})
|
|
380
|
+
<
|
|
381
|
+
Parameters ~
|
|
382
|
+
{items} `(table)` Array of items from LSP response.
|
|
383
|
+
{base} `(string)` Base for which completion is done. See |complete-functions|.
|
|
384
|
+
{opts} `(table|nil)` Options. Possible fields:
|
|
385
|
+
- <filtersort> `(string|function)` - method of filtering and sorting items.
|
|
386
|
+
If string, should be one of the following:
|
|
387
|
+
- `'prefix'` - filter out items not starting with `base`, sort according
|
|
388
|
+
to LSP specification. Use `filterText` and `sortText` respectively with
|
|
389
|
+
fallback to `label`.
|
|
390
|
+
- `'fuzzy'` - filter and sort with |matchfuzzy()| using `filterText`.
|
|
391
|
+
- `'none'` - no filter and no sort.
|
|
392
|
+
If callable, should take `items` and `base` arguments and return items array.
|
|
393
|
+
Default: `'fuzzy'` if |'completeopt'| contains "fuzzy", `'prefix'` otherwise.
|
|
394
|
+
- <kind_priority> `(table)` - map of completion item kinds (like `Variable`,
|
|
395
|
+
`Snippet`; see string keys of `vim.lsp.protocol.CompletionItemKind`) to
|
|
396
|
+
their numerical priority. It will be used after applying <filtersort> to
|
|
397
|
+
arrange by completion item kind: items with negative priority kinds will
|
|
398
|
+
be filtered out, the rest are sorted by decreasing priority (preserving
|
|
399
|
+
order in case of same priority).
|
|
400
|
+
Priorities can be any number, only matters how they compare to each other.
|
|
401
|
+
Value 100 is used for missing kinds (i.e. not all can be supplied).
|
|
402
|
+
Default: `{}` (all equal priority).
|
|
403
|
+
|
|
404
|
+
Return ~
|
|
405
|
+
`(table)` Array of processed items from LSP response.
|
|
406
|
+
|
|
407
|
+
------------------------------------------------------------------------------
|
|
408
|
+
*MiniCompletion.default_snippet_insert()*
|
|
409
|
+
`MiniCompletion.default_snippet_insert`({snippet})
|
|
410
|
+
Default snippet insert
|
|
411
|
+
|
|
412
|
+
Order of preference:
|
|
413
|
+
- Use |mini.snippets| if set up (i.e. after `require('mini.snippets').setup()`).
|
|
414
|
+
- Use |vim.snippet.expand()| on Neovim>=0.10
|
|
415
|
+
- Add snippet text at cursor as is.
|
|
416
|
+
|
|
417
|
+
After snippet is inserted, user is expected to navigate/jump between dedicated
|
|
418
|
+
places (tabstops) to adjust inserted text as needed:
|
|
419
|
+
- |mini.snippets| by default uses <C-l> / <C-h> to jump to next/previous tabstop.
|
|
420
|
+
Can be adjusted in `mappings` of |MiniSnippets.config|.
|
|
421
|
+
- |vim.snippet| on Neovim=0.10 requires manually created mappings for jumping
|
|
422
|
+
between tabstops (see |vim.snippet.jump()|). Neovim>=0.11 sets them up
|
|
423
|
+
automatically to <Tab> / <S-Tab> (if not overridden by user).
|
|
424
|
+
|
|
425
|
+
End session by navigating all the way to the last tabstop. In |mini.snippets|:
|
|
426
|
+
- Also make any text edit or exit Insert mode to end the session. This allows
|
|
427
|
+
smoother navigation to previous tabstops in case of a lately spotted typo.
|
|
428
|
+
- Press `<C-c>` to force session stop.
|
|
429
|
+
|
|
430
|
+
Parameters ~
|
|
431
|
+
{snippet} `(string)` Snippet body to insert at cursor.
|
|
432
|
+
|
|
433
|
+
See also ~
|
|
434
|
+
- |MiniSnippets-session| if |mini.snippets| is set up.
|
|
435
|
+
- |vim.snippet| for Neovim's built-in snippet engine.
|
|
436
|
+
|
|
437
|
+
------------------------------------------------------------------------------
|
|
438
|
+
*MiniCompletion.get_lsp_capabilities()*
|
|
439
|
+
`MiniCompletion.get_lsp_capabilities`({opts})
|
|
440
|
+
Get client LSP capabilities
|
|
441
|
+
|
|
442
|
+
Possible usages:
|
|
443
|
+
- On Neovim>=0.11 via |vim.lsp.config()|: >lua
|
|
444
|
+
|
|
445
|
+
vim.lsp.config('*', {capabilities = MiniCompletion.get_lsp_capabilities()})
|
|
446
|
+
<
|
|
447
|
+
- Together with |vim.lsp.protocol.make_client_capabilities()| to get the full
|
|
448
|
+
client capabilities (use |vim.tbl_deep_extend()| to merge tables).
|
|
449
|
+
|
|
450
|
+
- Manually execute `:=MiniCompletion.get_lsp_capabilities()` to see the info.
|
|
451
|
+
|
|
452
|
+
Notes:
|
|
453
|
+
- It declares completion resolve support for `'additionalTextEdits'` (usually
|
|
454
|
+
used for something like auto-import feature), as it is usually a more robust
|
|
455
|
+
choice for various LSP servers. As a consequence, this requires selecting
|
|
456
|
+
completion item and waiting for `config.delay.info` milliseconds plus server
|
|
457
|
+
response time (i.e. until information window shows relevant text).
|
|
458
|
+
To not have to wait after an item selection and if the server handles absent
|
|
459
|
+
`'additionalTextEdits'` well, set `opts.resolve_additional_text_edits = false`.
|
|
460
|
+
|
|
461
|
+
Parameters ~
|
|
462
|
+
{opts} `(table|nil)` Options. Possible fields:
|
|
463
|
+
- <resolve_additional_text_edits> `(boolean)` - whether to declare
|
|
464
|
+
`'additionalTextEdits'` as possible to resolve in `'completionitem/resolve'`
|
|
465
|
+
request. See above "Notes" section.
|
|
466
|
+
Default: `true`.
|
|
467
|
+
|
|
468
|
+
Return ~
|
|
469
|
+
`(table)` Data about LSP capabilities supported by |mini.completion|. Has same
|
|
470
|
+
structure as relevant parts of |vim.lsp.protocol.make_client_capabilities()|.
|
|
471
|
+
|
|
472
|
+
See also ~
|
|
473
|
+
Structures of `completionClientCapabilities` and `signatureHelpClientCapabilities`
|
|
474
|
+
at https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
vim:tw=78:ts=8:noet:ft=help:norl:
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
*mini.cursorword* Autohighlight word under cursor
|
|
2
|
+
|
|
3
|
+
MIT License Copyright (c) 2021 Evgeni Chasnovski
|
|
4
|
+
|
|
5
|
+
------------------------------------------------------------------------------
|
|
6
|
+
*MiniCursorword*
|
|
7
|
+
Features:
|
|
8
|
+
- Autohighlight word under cursor with customizable delay.
|
|
9
|
+
|
|
10
|
+
- Current word under cursor can be highlighted differently.
|
|
11
|
+
|
|
12
|
+
- Highlighting is triggered only if current cursor character is a |[:keyword:]|.
|
|
13
|
+
|
|
14
|
+
- Highlighting stops in insert and terminal modes.
|
|
15
|
+
|
|
16
|
+
- "Word under cursor" is meant as in Vim's |<cword>|: something user would
|
|
17
|
+
get as |iw| text object.
|
|
18
|
+
|
|
19
|
+
# Setup ~
|
|
20
|
+
|
|
21
|
+
This module needs a setup with `require('mini.cursorword').setup({})`
|
|
22
|
+
(replace `{}` with your `config` table). It will create global Lua table
|
|
23
|
+
`MiniCursorword` which you can use for scripting or manually (with
|
|
24
|
+
`:lua MiniCursorword.*`).
|
|
25
|
+
|
|
26
|
+
See |MiniCursorword.config| for `config` structure and default values.
|
|
27
|
+
|
|
28
|
+
You can override runtime config settings locally to buffer inside
|
|
29
|
+
`vim.b.minicursorword_config` which should have same structure as
|
|
30
|
+
`MiniCursorword.config`. See |mini.nvim-buffer-local-config| for more details.
|
|
31
|
+
|
|
32
|
+
# Highlight groups ~
|
|
33
|
+
*MiniCursorword-hl-groups*
|
|
34
|
+
|
|
35
|
+
- `MiniCursorword` - highlight group of a non-current cursor word.
|
|
36
|
+
Default: plain underline.
|
|
37
|
+
|
|
38
|
+
- `MiniCursorwordCurrent` - highlight group of a current word under cursor.
|
|
39
|
+
Default: links to `MiniCursorword` (so `:hi clear MiniCursorwordCurrent`
|
|
40
|
+
will lead to showing `MiniCursorword` highlight group).
|
|
41
|
+
Note: To not highlight it, use the following Lua code: >lua
|
|
42
|
+
|
|
43
|
+
vim.api.nvim_set_hl(0, 'MiniCursorwordCurrent', {})
|
|
44
|
+
<
|
|
45
|
+
To change any highlight group, set it directly with |nvim_set_hl()|.
|
|
46
|
+
|
|
47
|
+
# Disabling ~
|
|
48
|
+
|
|
49
|
+
To disable core functionality, set `vim.g.minicursorword_disable` (globally) or
|
|
50
|
+
`vim.b.minicursorword_disable` (for a buffer) to `true`. Considering high
|
|
51
|
+
number of different scenarios and customization intentions, writing exact
|
|
52
|
+
rules for disabling module's functionality is left to user. See
|
|
53
|
+
|mini.nvim-disabling-recipes| for common recipes. Note: after disabling
|
|
54
|
+
there might be highlighting left; it will be removed after next
|
|
55
|
+
highlighting update.
|
|
56
|
+
|
|
57
|
+
Module-specific disabling:
|
|
58
|
+
- Don't show highlighting if cursor is on the word that is in a blocklist
|
|
59
|
+
of current filetype. In this example, blocklist for "lua" is "local" and
|
|
60
|
+
"require" words, for "javascript" - "import": >lua
|
|
61
|
+
|
|
62
|
+
_G.cursorword_blocklist = function()
|
|
63
|
+
local curword = vim.fn.expand('<cword>')
|
|
64
|
+
local filetype = vim.bo.filetype
|
|
65
|
+
|
|
66
|
+
-- Add any disabling global or filetype-specific logic here
|
|
67
|
+
local blocklist = {}
|
|
68
|
+
if filetype == 'lua' then
|
|
69
|
+
blocklist = { 'local', 'require' }
|
|
70
|
+
elseif filetype == 'javascript' then
|
|
71
|
+
blocklist = { 'import' }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
vim.b.minicursorword_disable = vim.tbl_contains(blocklist, curword)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
-- Make sure to add this autocommand *before* calling module's `setup()`.
|
|
78
|
+
vim.cmd('au CursorMoved * lua _G.cursorword_blocklist()')
|
|
79
|
+
<
|
|
80
|
+
------------------------------------------------------------------------------
|
|
81
|
+
*MiniCursorword.setup()*
|
|
82
|
+
`MiniCursorword.setup`({config})
|
|
83
|
+
Module setup
|
|
84
|
+
|
|
85
|
+
Parameters ~
|
|
86
|
+
{config} `(table|nil)` Module config table. See |MiniCursorword.config|.
|
|
87
|
+
|
|
88
|
+
Usage ~
|
|
89
|
+
>lua
|
|
90
|
+
require('mini.cursorword').setup() -- use default config
|
|
91
|
+
-- OR
|
|
92
|
+
require('mini.cursorword').setup({}) -- replace {} with your config table
|
|
93
|
+
<
|
|
94
|
+
------------------------------------------------------------------------------
|
|
95
|
+
*MiniCursorword.config*
|
|
96
|
+
`MiniCursorword.config`
|
|
97
|
+
Defaults ~
|
|
98
|
+
>lua
|
|
99
|
+
MiniCursorword.config = {
|
|
100
|
+
-- Delay (in ms) between when cursor moved and when highlighting appeared
|
|
101
|
+
delay = 100,
|
|
102
|
+
}
|
|
103
|
+
<
|
|
104
|
+
|
|
105
|
+
vim:tw=78:ts=8:noet:ft=help:norl:
|