wilder.nvim icon indicating copy to clipboard operation
wilder.nvim copied to clipboard

[Question] A Way To Let The Menu Only Show After Pressing Tab

Open JuniorSuperTux opened this issue 4 years ago • 3 comments

I find it annoying to see the wildmenu always show as I am typing. Is there a way to let wildmenu only show after pressing tab when typing command just like initially with the default wildmenu?

JuniorSuperTux avatar Dec 26 '21 04:12 JuniorSuperTux

This is a duplicate of #86, see the comment at https://github.com/gelguy/wilder.nvim/issues/86#issuecomment-921054839 for the relevant config.

gelguy avatar Dec 26 '21 12:12 gelguy

What if I want the first option to be selected when I trigger the wildmenu? How could I do that? Because it's not when the menu is triggered.

JuniorSuperTux avatar Dec 27 '21 15:12 JuniorSuperTux

This requires a bit more configuration and uses an experimental API (which I may remove in the future).

autocmd CmdlineEnter * let g:active = 0
function! s:handle_tab()
   if !g:active
    let g:active = 1
    return wilder#main#next_when_available() . wilder#next()
  endif
  return wilder#next()
endfunction

cnoremap <expr> <Tab> wilder#in_context() ? <SID>handle_tab() : "\<Tab>"

wilder#main#next_when_available() sets a flag which selects the first candidate when the candidates are retrieved.

gelguy avatar Dec 27 '21 17:12 gelguy