Skip to content

Feat: Extend 'wildmode' Completion to Search Pattern Contexts - #17570

Closed
girishji wants to merge 3 commits into
vim:masterfrom
girishji:substcompl
Closed

girishji wants to merge 3 commits into
vim:masterfrom
girishji:substcompl

Conversation

@girishji

@girishji girishji commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

Extend 'wildmode' Completion to Search Pattern Contexts

This change enables 'wildmode' popup completion in search pattern contexts, enhancing usability when searching for or substituting text in a large codebase.


Use Case

While searching (using / or ?) for lines containing a pattern like "foobar", you can now type a partial pattern (e.g., /f) followed by a trigger key (wildcharm) to open a popup completion menu showing all matching words.

This offers two key benefits:

  1. Precision: Select the exact word you're looking for without typing it fully.
  2. Memory aid: When you can’t recall a full function or variable name, typing a few letters helps you visually identify and complete the correct symbol.

What’s New

Completion is now supported in the following contexts:

  • / and ? search commands
  • :s, :g, :v, and :vim commands

Design Notes

  • Only 'wildcharm' triggers completion in search contexts, not 'wildchar'.

    • Reason: 'wildchar' (usually <Tab>) may be intended to insert a literal tab character in searches or substitution patterns.
  • Responsiveness: Search remains responsive because it checks for user input frequently.


Try It Out

Basic setup using <C-Z> as the completion trigger:

set wim=noselect,full wop=pum wcm=<C-Z> wmnu

Now type:

/foo<C-Z>

This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type /\<foo<C-Z>.


⚡ Optional: Autocompletion

For automatic popup menu completion as you type in search or : commands, include this in your .vimrc:

vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu

autocmd CmdlineChanged [:/?] CmdComplete()

def CmdComplete()
  var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(), expand('<afile>') == ':']
  var trigger_char = '\%(\w\|[*/:.-]\)$'
  var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$'  # Exclude numeric range
  if getchar(1, {number: true}) == 0  # Typehead is empty, no more pasted input
      && !wildmenumode() && curpos == cmdline->len() + 1
      && (!cmdmode || (cmdline =~ trigger_char && cmdline !~ not_trigger_char))
    SkipCmdlineChanged()
    feedkeys("\<C-@>", "t")
    timer_start(0, (_) => getcmdline()->substitute('\%x00', '', 'ge')->setcmdline())  # Remove <C-@>
  endif
enddef

def SkipCmdlineChanged(key = ''): string
  set ei+=CmdlineChanged
  timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
  return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef

# Optional: Preserve history recall behavior
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")

# Optional: Customize popup height
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10, winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&

Screenshot 2025-06-18 at 1 29 40 PM

@chrisbra

Copy link
Copy Markdown
Member

Oh very nice.

Only 'wildcharm' triggers completion in search contexts, not 'wildchar'.

However that is a bit inconsistent. Would it work to use 'wildchar' instead and if one wanted to type a literal <Tab> one would need to type <Ctrl-V><Tab> or \t instead (or possibly unset wildchar in an CmdlineEnter autocommand)?

@girishji

girishji commented Jun 19, 2025 •

Copy link
Copy Markdown
Contributor Author

Oh very nice.

Only 'wildcharm' triggers completion in search contexts, not 'wildchar'.

However that is a bit inconsistent. Would it work to use 'wildchar' instead and if one wanted to type a literal <Tab> one would need to type <Ctrl-V><Tab> or \t instead (or possibly unset wildchar in an CmdlineEnter autocommand)?

It would work and is relatively straightforward to implement. However, let's wait a few days to see if there are any objections since it does break backward compatibility.

@girishji

girishji commented Jun 22, 2025 •

Copy link
Copy Markdown
Contributor Author

Oh very nice.

Only 'wildcharm' triggers completion in search contexts, not 'wildchar'.

However that is a bit inconsistent. Would it work to use 'wildchar' instead and if one wanted to type a literal <Tab> one would need to type <Ctrl-V><Tab> or \t instead (or possibly unset wildchar in an CmdlineEnter autocommand)?

Now 'wildchar' and 'wildcharm' have compatible behaviour. Thanks for feedback.

@girishji

girishji commented Jun 22, 2025 •

Copy link
Copy Markdown
Contributor Author

Here are a few things I just remembered:

  • :g/pat/s/pattern<Tab> will not trigger completion. It doesn’t make sense to execute a :g command solely to complete the :s portion.

  • Most types of ranges are supported. However, if there's a \n before \zs, the actual match may occur on a line after the one being searched. In such cases, the match may not be found during completion.
    A good rule of thumb: if :hlsearch can find the match, then it will likely show up here too.

  • If list is included in the 'wildmode' option, hlsearch is temporarily disabled during completion. Otherwise, the screen redraw would erase the matches list.

Comment thread runtime/doc/options.txt Outdated
Comment thread runtime/doc/options.txt Outdated
@girishji

girishji commented Jun 23, 2025 •

Copy link
Copy Markdown
Contributor Author

One more thing: If your pattern includes a beginning-of-line or beginning-of-word anchor (like ^, \<, \v<, \c\<, etc.), it will be preserved in the menu items. You’re welcome. 😉

@chrisbra

Copy link
Copy Markdown
Member

Any other comments?

@dkearns

dkearns commented Jun 23, 2025

Copy link
Copy Markdown
Contributor

Thanks, this looks handy.

Is there a reason not to include other commands accepting pattern args like :match?

Comment thread src/cmdexpand.c

#if defined(FEAT_SEARCH_EXTRA) || defined(PROTO)
// Clear highlighting applied during wildmenu activity
set_no_hlsearch(TRUE);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be done only conditionally if (wild_menu_showing) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already checked though:

if (!p_wmnu || wild_menu_showing == 0)

@girishji girishji Jun 24, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn’t able to write a test for this, as even RunVimInTerminal() doesn't retain hlsearch highlights when the completion menu is visible during a screen dump. A potential test would involve triggering the completion menu with hlsearch active, then sending <C-C> or <Esc> and check that highlighting has disappeared.

Comment thread src/cmdexpand.c Outdated
magic = (c == 'v') ? 1 : (c == 'V' ? 2 : magic);
if (c == 'v' || c == 'V' || c == 'm' || c == 'M' || c == 'c'
|| c == 'C')
i += 2;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems a bit brittle, as the magicness could also be later in the pattern (e.g. the engine always has to come first). Should you use skip_regexp_ex() instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skip_regexp_ex() doesn't quite work for this use case. The core requirement is to preserve the < or ^ tags when the user types them at the beginning of a pattern—otherwise, the completed matches may not be accurate during the actual search.

The interest in the 'magic' tag is primarily to determine whether a backslash should be included before < or ^. Ideally, these tags should be preserved anywhere in the pattern, but handling that comprehensively would add significant complexity.

The problem with skip_regexp_ex() is that it simply identifies the magic type used in the pattern, which isn't sufficient. It also skips over character classes like [], which is undesirable in this context.

One alternative I tried was retaining the full regex pattern as typed (including wildcards) and only completing the last word. However, this approach introduces ambiguity when ignorecase and smartcase are enabled, making it harder to determine correct matches.

Strictly speaking, the code that preserves < and ^ at the beginning of the pattern is a bit of a hack. But it's practical, effective, and in my opinion, necessary—removing it would break a key part of the user experience. The current solution is simple, handles 99% of use cases, and as far as I can tell, is not brittle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed approach:
I've made significant updates. Now, the matches retain the exact regex pattern typed by the user, and the completed word is appended directly to that pattern.

This preserves all regex elements — such as <, ^, grouping brackets, wildcards, and other special characters — in their original positions. Matching also correctly respects 'ignorecase' and 'smartcase'.

I've removed the previous code you commented on. Please take another look and review the new implementation.

Comment thread src/cmdexpand.c Outdated
for (lnum = start->lnum + 1; lnum < end->lnum; lnum++)
{
line = ml_get(lnum);
int line_len = (int)STRLEN(line);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int line_len = (int)STRLEN(line);
int line_len = ml_get_len(line);

@girishji girishji Jun 24, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct. Did you mean ml_get_len(lnum)? In any case, we need to retrieve the entire line as a string through (ml_get()), so STRLEN() seems appropriate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry, ml_get_len(lnum). This saves us a call to STRLEN().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand now. buf->b_ml.ml_line_textlen already has length calculated. Good call.

@chrisbra

Copy link
Copy Markdown
Member

BTW: how does it handle empty patterns, like /\| or \& or similar? That could match quite a bit in an long file. Perhaps we should skip this if empty_pattern_magic() is true?

@girishji

girishji commented Jun 24, 2025 •

Copy link
Copy Markdown
Contributor Author

Thanks, this looks handy.

Is there a reason not to include other commands accepting pattern args like :match?

:match is already treated different though. hlsearch does not highlight the pattern for this command, unlike for :s.

@girishji

Copy link
Copy Markdown
Contributor Author

BTW: how does it handle empty patterns, like /\| or \& or similar? That could match quite a bit in an long file. Perhaps we should skip this if empty_pattern_magic() is true?

Patterns that match everything are already skipped:

empty = empty_pattern_magic(p, (size_t)(end - p), magic);

@chrisbra chrisbra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I am fine except with the single comment. Can you please squash into a single commit?

Comment thread src/cmdexpand.c Outdated
for (lnum = start->lnum + 1; lnum < end->lnum; lnum++)
{
line = ml_get(lnum);
int line_len = (int)STRLEN(line);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry, ml_get_len(lnum). This saves us a call to STRLEN().

This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:

* '/' and '?' search commands
* ':s', ':g', ':v', and ':vim' commands

Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.
@girishji

Copy link
Copy Markdown
Contributor Author

Thanks, I am fine except with the single comment. Can you please squash into a single commit?

Squashed, thanks.

@chrisbra

Copy link
Copy Markdown
Member

Sorry, you seem to have reverted v9.1.1475 commit accidentally

M  src/insexpand.c
@girishji

Copy link
Copy Markdown
Contributor Author

Sorry, you seem to have reverted v9.1.1475 commit accidentally

Fixed. Sorry about that.

@chrisbra

Copy link
Copy Markdown
Member

thanks for this. Very nice!

@chrisbra chrisbra closed this in 6b49fba Jun 28, 2025
chrisbra pushed a commit that referenced this pull request Jun 28, 2025
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add out-of-memory checks for expand_files_and_dirs(),
          ExpandUserDefined() and ExpandUserList()
          (John Marriott)

closes: #17570

Signed-off-by: John Marriott <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
64-bitman pushed a commit to 64-bitman/vim that referenced this pull request Jun 28, 2025
Problem:  'wildchar' does not work in search contexts
Solution: implement search completion when 'wildchar' is typed
          (Girish Palya).

This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:

- '/' and '?' search commands
- ':s', ':g', ':v', and ':vim' commands

Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.

---

**Use Case**

While searching (using `/` or `?`) for lines containing a pattern like
`"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by
a trigger key (`wildchar`) to open a **popup completion menu** showing
all matching words.

This offers two key benefits:

1. **Precision**: Select the exact word you're looking for without
typing it fully.
2. **Memory aid**: When you can’t recall a full function or variable
name, typing a few letters helps you visually identify and complete the
correct symbol.

---

**What’s New**

Completion is now supported in the following contexts:

- `/` and `?` search commands
- `:s`, `:g`, `:v`, and `:vimgrep` ex-commands

---

**Design Notes**

- While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have
to use `<CTRL-V><Tab>` or "\t" to search for a literal tab.
- **Responsiveness**: Search remains responsive because it checks for
user input frequently.

---

**Try It Out**

Basic setup using the default `<Tab>` as the completion trigger:

```vim
set wim=noselect,full wop=pum wmnu
```

Now type:

```
/foo<Tab>
```

This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type `/\<foo<Tab>`.

---

**Optional: Autocompletion**

For automatic popup menu completion as you type in search or `:`
commands, include this in your `.vimrc`:

```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu

autocmd CmdlineChanged [:/?] CmdComplete()

def CmdComplete()
  var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(),
expand('<afile>') == ':']
  var trigger_char = '\%(\w\|[*/:.-]\)$'
  var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$'  # Exclude numeric range
  if getchar(1, {number: true}) == 0  # Typehead is empty, no more
pasted input
      && !wildmenumode() && curpos == cmdline->len() + 1
      && (!cmdmode || (cmdline =~ trigger_char && cmdline !~
not_trigger_char))
    SkipCmdlineChanged()
    feedkeys("\<C-@>", "t")
    timer_start(0, (_) => getcmdline()->substitute('\%x00', '',
'ge')->setcmdline())  # Remove <C-@>
  endif
enddef

def SkipCmdlineChanged(key = ''): string
  set ei+=CmdlineChanged
  timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
  return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef

**Optional: Preserve history recall behavior**
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")

**Optional: Customize popup height**
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10,
winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&
```

closes: vim#17570

Signed-off-by: Girish Palya <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
@girishji

Copy link
Copy Markdown
Contributor Author

Thanks!

zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jul 4, 2025
Problem:  'wildchar' does not work in search contexts
Solution: implement search completion when 'wildchar' is typed
          (Girish Palya).

This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:

- '/' and '?' search commands
- ':s', ':g', ':v', and ':vim' commands

Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.

---

**Use Case**

While searching (using `/` or `?`) for lines containing a pattern like
`"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by
a trigger key (`wildchar`) to open a **popup completion menu** showing
all matching words.

This offers two key benefits:

1. **Precision**: Select the exact word you're looking for without
typing it fully.
2. **Memory aid**: When you can’t recall a full function or variable
name, typing a few letters helps you visually identify and complete the
correct symbol.

---

**What’s New**

Completion is now supported in the following contexts:

- `/` and `?` search commands
- `:s`, `:g`, `:v`, and `:vimgrep` ex-commands

---

**Design Notes**

- While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have
to use `<CTRL-V><Tab>` or "\t" to search for a literal tab.
- **Responsiveness**: Search remains responsive because it checks for
user input frequently.

---

**Try It Out**

Basic setup using the default `<Tab>` as the completion trigger:

```vim
set wim=noselect,full wop=pum wmnu
```

Now type:

```
/foo<Tab>
```

This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type `/\<foo<Tab>`.

---

**Optional: Autocompletion**

For automatic popup menu completion as you type in search or `:`
commands, include this in your `.vimrc`:

```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu

autocmd CmdlineChanged [:/?] CmdComplete()

def CmdComplete()
  var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(),
expand('<afile>') == ':']
  var trigger_char = '\%(\w\|[*/:.-]\)$'
  var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$'  # Exclude numeric range
  if getchar(1, {number: true}) == 0  # Typehead is empty, no more
pasted input
      && !wildmenumode() && curpos == cmdline->len() + 1
      && (!cmdmode || (cmdline =~ trigger_char && cmdline !~
not_trigger_char))
    SkipCmdlineChanged()
    feedkeys("\<C-@>", "t")
    timer_start(0, (_) => getcmdline()->substitute('\%x00', '',
'ge')->setcmdline())  # Remove <C-@>
  endif
enddef

def SkipCmdlineChanged(key = ''): string
  set ei+=CmdlineChanged
  timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
  return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef

**Optional: Preserve history recall behavior**
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")

**Optional: Customize popup height**
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10,
winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&
```

closes: vim/vim#17570

vim/vim@6b49fba

Co-authored-by: Girish Palya <[email protected]>
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Jul 5, 2025
Problem:  'wildchar' does not work in search contexts
Solution: implement search completion when 'wildchar' is typed
          (Girish Palya).

This change enhances Vim's command-line completion by extending
'wildmode' behavior to search pattern contexts, including:

- '/' and '?' search commands
- ':s', ':g', ':v', and ':vim' commands

Completions preserve the exact regex pattern typed by the user,
appending the completed word directly to the original input. This
ensures that all regex elements — such as '<', '^', grouping brackets
'()', wildcards '\*', '.', and other special characters — remain intact
and in their original positions.

---

**Use Case**

While searching (using `/` or `?`) for lines containing a pattern like
`"foobar"`, you can now type a partial pattern (e.g., `/f`) followed by
a trigger key (`wildchar`) to open a **popup completion menu** showing
all matching words.

This offers two key benefits:

1. **Precision**: Select the exact word you're looking for without
typing it fully.
2. **Memory aid**: When you can’t recall a full function or variable
name, typing a few letters helps you visually identify and complete the
correct symbol.

---

**What’s New**

Completion is now supported in the following contexts:

- `/` and `?` search commands
- `:s`, `:g`, `:v`, and `:vimgrep` ex-commands

---

**Design Notes**

- While `'wildchar'` (usually `<Tab>`) triggers completion, you'll have
to use `<CTRL-V><Tab>` or "\t" to search for a literal tab.
- **Responsiveness**: Search remains responsive because it checks for
user input frequently.

---

**Try It Out**

Basic setup using the default `<Tab>` as the completion trigger:

```vim
set wim=noselect,full wop=pum wmnu
```

Now type:

```
/foo<Tab>
```

This opens a completion popup for matches containing "foo".
For matches beginning with "foo" type `/\<foo<Tab>`.

---

**Optional: Autocompletion**

For automatic popup menu completion as you type in search or `:`
commands, include this in your `.vimrc`:

```vim
vim9script
set wim=noselect:lastused,full wop=pum wcm=<C-@> wmnu

autocmd CmdlineChanged [:/?] CmdComplete()

def CmdComplete()
  var [cmdline, curpos, cmdmode] = [getcmdline(), getcmdpos(),
expand('<afile>') == ':']
  var trigger_char = '\%(\w\|[*/:.-]\)$'
  var not_trigger_char = '^\%(\d\|,\|+\|-\)\+$'  # Exclude numeric range
  if getchar(1, {number: true}) == 0  # Typehead is empty, no more
pasted input
      && !wildmenumode() && curpos == cmdline->len() + 1
      && (!cmdmode || (cmdline =~ trigger_char && cmdline !~
not_trigger_char))
    SkipCmdlineChanged()
    feedkeys("\<C-@>", "t")
    timer_start(0, (_) => getcmdline()->substitute('\%x00', '',
'ge')->setcmdline())  # Remove <C-@>
  endif
enddef

def SkipCmdlineChanged(key = ''): string
  set ei+=CmdlineChanged
  timer_start(0, (_) => execute('set ei-=CmdlineChanged'))
  return key == '' ? '' : ((wildmenumode() ? "\<C-E>" : '') .. key)
enddef

**Optional: Preserve history recall behavior**
cnoremap <expr> <Up> SkipCmdlineChanged("\<Up>")
cnoremap <expr> <Down> SkipCmdlineChanged("\<Down>")

**Optional: Customize popup height**
autocmd CmdlineEnter : set bo+=error | exec $'set ph={max([10,
winheight(0) - 4])}'
autocmd CmdlineEnter [/?] set bo+=error | set ph=8
autocmd CmdlineLeave [:/?] set bo-=error ph&
```

closes: vim/vim#17570

vim/vim@6b49fba

Co-authored-by: Girish Palya <[email protected]>
@Shane-XB-Qian

This comment was marked as off-topic.

@girishji

Copy link
Copy Markdown
Contributor Author

thanks the patch, could you also make it work like 'menuone' (of 'cot') ? seems it may lost compl popup after some char typed, but 'menuone' may make it always display there, perhaps useful.

Try set wim=noselect,full. It should work like menuone.

@Shane-XB-Qian

This comment was marked as off-topic.

@dezza

dezza commented Aug 1, 2025 •

Copy link
Copy Markdown
Contributor

Very cool PR, ty for working on this.

I found an issue. If you load above snippet with vim --clean -u test.vim -U NONE in clean vim, then

:help various.txt and /- then you will receive:

E877: (NFA regexp) Invalid character class 101

I assume this is some setting set by help filetype plugin that interferes. (it does not happen without &ft=help)

@girishji

girishji commented Aug 1, 2025

Copy link
Copy Markdown
Contributor Author

Very cool PR, ty for working on this.

I found an issue. If you load above snippet with vim --clean -u test.vim -U NONE in clean vim, then

:help various.txt and /- then you will receive:

E877: (NFA regexp) Invalid character class 101

I assume this is some setting set by help filetype plugin that interferes. (it does not happen without &ft=help)

You forgot to post what is in test.vim.

@dezza

dezza commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

You forgot to post what is in test.vim.

above snippet

Meaning your autocomplete func

@girishji

girishji commented Aug 1, 2025 •

Copy link
Copy Markdown
Contributor Author

The autocomplete snippet above is no longer supported. It is replaced by #17806 (and #17890).

Read :h cmdline-autocompletion.

autocmd CmdlineChanged [:/\?] call wildtrigger()
set wildmode=noselect:lastused,full wildoptions=pum

@dezza

dezza commented Aug 1, 2025

Copy link
Copy Markdown
Contributor

The autocomplete snippet above is no longer supported. It is replaced by #17806 (and #17890).

Read :h cmdline-autocompletion.


autocmd CmdlineChanged [:/\?] call wildtrigger()

set wildmode=noselect:lastused,full wildoptions=pum

Thank you, will check that out!

janlazo added a commit to janlazo/neovim that referenced this pull request Dec 24, 2025
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add out-of-memory checks for expand_files_and_dirs(),
          ExpandUserDefined() and ExpandUserList()
          (John Marriott)

closes: vim/vim#17570

vim/vim@3b03b43

Co-authored-by: John Marriott <[email protected]>
HarshK97 pushed a commit to HarshK97/neovim that referenced this pull request Feb 13, 2026
Problem:  missing out-of-memory checks in cmdexpand.c
Solution: add out-of-memory checks for expand_files_and_dirs(),
          ExpandUserDefined() and ExpandUserList()
          (John Marriott)

closes: vim/vim#17570

vim/vim@3b03b43

Co-authored-by: John Marriott <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants