Search code examples
vimselectionneovim

nvim autocomplete menu, arrow selection. Invert left/right - up/down functions


When trying to select from a list, see image below, the left/right and up/down arrows are acting unintuitve (for me): The left/right move the selection up and down, while the down arrows selects it, the up arrow selects the item above the marked one.

I know the CTRL-N/P but how can I use the arrows in a more intuitive way? Is there a setting I can change? A remap I can define?

Thanks all..

enter image description here


Solution

  • Since I was asked, this is what I did:

    set wildcharm=<C-Z>
    cnoremap <expr> <up> wildmenumode() ? "\<left>" : "\<up>"
    cnoremap <expr> <down> wildmenumode() ? "\<right>" : "\<down>"
    cnoremap <expr> <left> wildmenumode() ? "\<up>" : "\<left>"
    cnoremap <expr> <right> wildmenumode() ? " \<bs>\<C-Z>" : "\<right>"
    

    I stole it from someone, don't remember where. But all credit to whoever made it (wasn't me).