Skip to content

Commit 4f35ebc

Browse files
committed
feat(mini.nvim): sync to c889667
1 parent d537448 commit 4f35ebc

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

mini.nvim/doc/mini-cmdline.qmd

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ Module setup
179179
-- Number of lines to show above and below range lines
180180
n_context = 1,
181181

182+
-- Custom rule of when to show peek window
183+
predicate = nil,
184+
182185
-- Window options
183186
window = {
184187
-- Floating window config
@@ -269,6 +272,9 @@ Notes:
269272
See [MiniCmdline.default\_autocorrect\_func()](mini-cmdline.qmd#minicmdline.default_autocorrect_func) for details.
270273

271274

275+
- Word that matches some Command-line [abbreviation](https://neovim.io/doc/user/helptag.html?tag=abbreviation) is not autocorrected.
276+
277+
272278
- If current command expects only a single argument (like [:colorscheme](https://neovim.io/doc/user/helptag.html?tag=:colorscheme)), then
273279
autocorrection will happen only just before executing the command.
274280

@@ -294,6 +300,22 @@ left) range lines.
294300
The range itself is visualized by default with the statuscolumn signs.
295301
Default: 1.
296302

303+
`autopeek.predicate` defines a condition of whether to show peek window at
304+
the current command line state. Takes a table with input data and should
305+
return `true` to peek and `false` otherwise.
306+
Will be called only if it is possible to parse range from the current command
307+
line text and it is for buffer lines (no command or [:command-addr](https://neovim.io/doc/user/helptag.html?tag=:command-addr) is `lines`)
308+
Default: [MiniCmdline.default\_autopeek\_predicate()](mini-cmdline.qmd#minicmdline.default_autopeek_predicate).
309+
310+
Input data fields:
311+
312+
- <span class="help-syntax-keys">\<left\></span> `(number)` - left range edge. Not necessarily smallest.
313+
314+
- <span class="help-syntax-keys">\<right\></span> `(number)` - right range edge. Same as `left` for a single line range.
315+
316+
- <span class="help-syntax-keys">\<cmd\></span> `(string)` - full command name. Can be empty string if no valid
317+
command is (yet) entered.
318+
297319
`autopeek.window` defines behavior of a peek window.
298320
`autopeek.window.config` is a table defining floating window characteristics
299321
or a callable returning such table.
@@ -303,11 +325,7 @@ It should have the same structure as in [nvim\_open\_win()](https://neovim.io/do
303325
customize ['statuscolumn'](https://neovim.io/doc/user/helptag.html?tag='statuscolumn') value for the peek window. Takes a table with input
304326
data and should return a string to display for line [v:lnum](https://neovim.io/doc/user/helptag.html?tag=v:lnum).
305327
Default: [MiniCmdline.default\_autopeek\_statuscolumn()](mini-cmdline.qmd#minicmdline.default_autopeek_statuscolumn).
306-
Input data fields:
307-
308-
- <span class="help-syntax-keys">\<left\></span> `(number)` - left range edge. Not necessarily smallest.
309-
310-
- <span class="help-syntax-keys">\<right\></span> `(number)` - right range edge. Same as `left` for a single line range.
328+
Input data fields are the same as for `autopeek.predicate`.
311329

312330
Example of showing `<` and `>` signs on range lines:
313331

@@ -415,6 +433,28 @@ Default autocorrection function
415433

416434
---
417435

436+
### default_autopeek_predicate() {#minicmdline.default_autopeek_predicate .help-syntax-right-anchor}
437+
438+
<p align="center">`MiniCmdline.default_autopeek_predicate`(<span class="help-syntax-special">{data}</span>, <span class="help-syntax-special">{opts}</span>)</p>
439+
Default autopeek predicate
440+
441+
#### Parameters {#minicmdline.default_autopeek_predicate-parameters}
442+
443+
444+
445+
<span class="help-syntax-special">{data}</span> `(table)` Input autopeek data. As described in [MiniCmdline.config](mini-cmdline.qmd#minicmdline.config).
446+
447+
<span class="help-syntax-special">{opts}</span> `(table|nil)` Options. Reserved for future use.
448+
449+
#### Return {#minicmdline.default_autopeek_predicate-return}
450+
451+
452+
`(boolean)` If command defines [:command-preview](https://neovim.io/doc/user/helptag.html?tag=:command-preview) - `false`, otherwise - `true`.
453+
This makes autopeek easier to use for commands like [:substitute](https://neovim.io/doc/user/helptag.html?tag=:substitute),
454+
especially if ['inccommand'](https://neovim.io/doc/user/helptag.html?tag='inccommand') is set to `split`.
455+
456+
---
457+
418458
### default_autopeek_statuscolumn() {#minicmdline.default_autopeek_statuscolumn .help-syntax-right-anchor}
419459

420460
<p align="center">`MiniCmdline.default_autopeek_statuscolumn`(<span class="help-syntax-special">{data}</span>, <span class="help-syntax-special">{opts}</span>)</p>

mini.nvim/readmes/mini-cmdline.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ Here are code snippets for some common installation methods (use only one):
153153
-- Number of lines to show above and below range lines
154154
n_context = 1,
155155

156+
-- Custom rule of when to show peek window
157+
predicate = nil,
158+
156159
-- Window options
157160
window = {
158161
-- Floating window config

0 commit comments

Comments
 (0)